Show More
@@ -43,12 +43,12 b' import time' | |||||
43 |
|
43 | |||
44 | # Roughtly equal to PyCF_MASK | PyCF_MASK_OBSOLETE as defined in pythonrun.h, |
|
44 | # Roughtly equal to PyCF_MASK | PyCF_MASK_OBSOLETE as defined in pythonrun.h, | |
45 | # this is used as a bitmask to extract future-related code flags. |
|
45 | # this is used as a bitmask to extract future-related code flags. | |
46 | PyCF_MASK = functools.reduce(operator.or_, |
|
46 | try: | |
47 | (getattr(__future__, fname).compiler_flag |
|
47 | PyCF_MASK = functools.reduce(operator.or_, | |
48 |
|
|
48 | (getattr(__future__, fname).compiler_flag | |
49 |
|
|
49 | for fname in __future__.all_feature_names)) | |
50 | hasattr(getattr(__future__, fname), "compiler_flag"))), |
|
50 | except AttributeError: # IronPython __future__'s are non-standard, 2/8/2014 | |
51 | 0) |
|
51 | PyCF_MASK = 0 | |
52 |
|
52 | |||
53 | #----------------------------------------------------------------------------- |
|
53 | #----------------------------------------------------------------------------- | |
54 | # Local utilities |
|
54 | # Local utilities |
@@ -66,10 +66,7 b' Notes:' | |||||
66 | # Imports |
|
66 | # Imports | |
67 | #----------------------------------------------------------------------------- |
|
67 | #----------------------------------------------------------------------------- | |
68 |
|
68 | |||
69 | try: |
|
69 | import __main__ | |
70 | import __main__ |
|
|||
71 | except ImportError: |
|
|||
72 | pass |
|
|||
73 | import glob |
|
70 | import glob | |
74 | import inspect |
|
71 | import inspect | |
75 | import itertools |
|
72 | import itertools |
@@ -148,6 +148,8 b' USER = py3compat.str_to_unicode(os.environ.get("USER",\'\'))' | |||||
148 | HOSTNAME = py3compat.str_to_unicode(socket.gethostname()) |
|
148 | HOSTNAME = py3compat.str_to_unicode(socket.gethostname()) | |
149 | HOSTNAME_SHORT = HOSTNAME.split(".")[0] |
|
149 | HOSTNAME_SHORT = HOSTNAME.split(".")[0] | |
150 |
|
150 | |||
|
151 | # IronPython doesn't currently have os.getuid() even if | |||
|
152 | # os.name == 'posix'; 2/8/2014 | |||
151 | ROOT_SYMBOL = "#" if (os.name=='nt' or sys.platform=='cli' or os.getuid()==0) else "$" |
|
153 | ROOT_SYMBOL = "#" if (os.name=='nt' or sys.platform=='cli' or os.getuid()==0) else "$" | |
152 |
|
154 | |||
153 | prompt_abbreviations = { |
|
155 | prompt_abbreviations = { |
@@ -139,7 +139,10 b' class FunctionMaker(object):' | |||||
139 | func.__defaults__ = getattr(self, 'defaults', ()) |
|
139 | func.__defaults__ = getattr(self, 'defaults', ()) | |
140 | func.__kwdefaults__ = getattr(self, 'kwonlydefaults', None) |
|
140 | func.__kwdefaults__ = getattr(self, 'kwonlydefaults', None) | |
141 | func.__annotations__ = getattr(self, 'annotations', None) |
|
141 | func.__annotations__ = getattr(self, 'annotations', None) | |
142 | callermodule = sys._getframe(3).f_globals.get('__name__', '?') |
|
142 | try: | |
|
143 | callermodule = sys._getframe(3).f_globals.get('__name__', '?') | |||
|
144 | except AttributeError: # IronPython _getframe only exists with FullFrames | |||
|
145 | callermodule = '?' | |||
143 | func.__module__ = getattr(self, 'module', callermodule) |
|
146 | func.__module__ = getattr(self, 'module', callermodule) | |
144 | func.__dict__.update(kw) |
|
147 | func.__dict__.update(kw) | |
145 |
|
148 |
@@ -18,7 +18,7 b' try:' | |||||
18 | import ctypes |
|
18 | import ctypes | |
19 | except ImportError: |
|
19 | except ImportError: | |
20 | ctypes = None |
|
20 | ctypes = None | |
21 | except SystemError: |
|
21 | except SystemError: # IronPython issue, 2/8/2014 | |
22 | ctypes = None |
|
22 | ctypes = None | |
23 | import os |
|
23 | import os | |
24 | import sys |
|
24 | import sys |
@@ -21,8 +21,7 b' from ._process_common import arg_split' | |||||
21 |
|
21 | |||
22 | def _find_cmd(cmd): |
|
22 | def _find_cmd(cmd): | |
23 | """Find the full path to a command using which.""" |
|
23 | """Find the full path to a command using which.""" | |
24 | os_path_sep = ":" if os.name == "posix" else ";" |
|
24 | paths = System.Environment.GetEnvironmentVariable("PATH").Split(os.pathsep) | |
25 | paths = System.Environment.GetEnvironmentVariable("PATH").Split(os_path_sep) |
|
|||
26 | for path in paths: |
|
25 | for path in paths: | |
27 | filename = os.path.join(path, cmd) |
|
26 | filename = os.path.join(path, cmd) | |
28 | if System.IO.File.Exists(filename): |
|
27 | if System.IO.File.Exists(filename): |
General Comments 0
You need to be logged in to leave comments.
Login now