Show More
@@ -11,13 +11,6 b' from __future__ import absolute_import' | |||
|
11 | 11 | import os |
|
12 | 12 | import sys |
|
13 | 13 | |
|
14 | if os.environ.get('HGUNICODEPEDANTRY', False): | |
|
15 | try: | |
|
16 | reload(sys) | |
|
17 | sys.setdefaultencoding("undefined") | |
|
18 | except NameError: | |
|
19 | pass | |
|
20 | ||
|
21 | 14 | libdir = '@LIBDIR@' |
|
22 | 15 | |
|
23 | 16 | if libdir != '@' 'LIBDIR' '@': |
@@ -104,19 +104,6 b' fn set_python_home(env: &Environment) {' | |||
|
104 | 104 | } |
|
105 | 105 | } |
|
106 | 106 | |
|
107 | fn update_encoding(_py: Python, _sys_mod: &PyModule) { | |
|
108 | // Call sys.setdefaultencoding("undefined") if HGUNICODEPEDANTRY is set. | |
|
109 | let pedantry = env::var("HGUNICODEPEDANTRY").is_ok(); | |
|
110 | ||
|
111 | if pedantry { | |
|
112 | // site.py removes the sys.setdefaultencoding attribute. So we need | |
|
113 | // to reload the module to get a handle on it. This is a lesser | |
|
114 | // used feature and we'll support this later. | |
|
115 | // TODO support this | |
|
116 | panic!("HGUNICODEPEDANTRY is not yet supported"); | |
|
117 | } | |
|
118 | } | |
|
119 | ||
|
120 | 107 | fn update_modules_path(env: &Environment, py: Python, sys_mod: &PyModule) { |
|
121 | 108 | let sys_path = sys_mod.get(py, "path").unwrap(); |
|
122 | 109 | sys_path |
@@ -210,7 +197,6 b' fn run() -> Result<(), i32> {' | |||
|
210 | 197 | fn run_py(env: &Environment, py: Python) -> PyResult<()> { |
|
211 | 198 | let sys_mod = py.import("sys").unwrap(); |
|
212 | 199 | |
|
213 | update_encoding(py, &sys_mod); | |
|
214 | 200 | update_modules_path(&env, py, &sys_mod); |
|
215 | 201 | |
|
216 | 202 | // TODO consider a better error message on failure to import. |
@@ -80,13 +80,6 b' except (ImportError, AttributeError):' | |||
|
80 | 80 | import pipes |
|
81 | 81 | shellquote = pipes.quote |
|
82 | 82 | |
|
83 | if os.environ.get('RTUNICODEPEDANTRY', False): | |
|
84 | try: | |
|
85 | reload(sys) | |
|
86 | sys.setdefaultencoding("undefined") | |
|
87 | except NameError: | |
|
88 | pass | |
|
89 | ||
|
90 | 83 | processlock = threading.Lock() |
|
91 | 84 | |
|
92 | 85 | pygmentspresent = False |
General Comments 0
You need to be logged in to leave comments.
Login now