Changeset 73930
- Timestamp:
- Jan 12, 2019, 2:06:55 AM (6 years ago)
- Location:
- grass/trunk
- Files:
-
- 4 edited
-
gui/wxpython/core/gcmd.py (modified) (2 diffs)
-
gui/wxpython/core/globalvar.py (modified) (1 diff)
-
gui/wxpython/core/utils.py (modified) (3 diffs)
-
lib/python/script/core.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
grass/trunk/gui/wxpython/core/gcmd.py
r73796 r73930 48 48 import fcntl 49 49 50 from core.debug import Debug 51 from core.globalvar import SCT_EXT, _ 52 50 53 from grass.script import core as grass 51 from core import globalvar52 from core.debug import Debug53 54 from grass.script.utils import decode 54 55 55 # cannot import from the core.utils module to avoid cross dependencies56 try:57 # intended to be used also outside this module58 import gettext59 _ = gettext.translation(60 'grasswxpy',61 os.path.join(62 os.getenv("GISBASE"),63 'locale')).ugettext64 except IOError:65 # using no translation silently66 def null_gettext(string):67 return string68 _ = null_gettext69 56 70 57 if sys.version_info.major == 2: … … 587 574 args = self.cmd 588 575 if sys.platform == 'win32': 589 if os.path.splitext(args[0])[1] == globalvar.SCT_EXT:576 if os.path.splitext(args[0])[1] == SCT_EXT: 590 577 args[0] = args[0][:-3] 591 578 # using Python executable to run the module if it is a script -
grass/trunk/gui/wxpython/core/globalvar.py
r71833 r73930 31 31 from core.debug import Debug 32 32 33 # cannot import from the core.utils module to avoid cross dependencies34 33 try: 35 34 # intended to be used also outside this module 36 35 import gettext 37 _ = gettext.translation(38 'grasswxpy',39 os.path.join(40 os.getenv("GISBASE"),41 'locale')).ugettext36 trans = gettext.translation('grasswxpy', 37 os.path.join(os.getenv("GISBASE"), 38 'locale') 39 ) 40 _ = trans.gettext if sys.version_info.major >=3 else trans.ugettext 42 41 except IOError: 43 42 # using no translation silently -
grass/trunk/gui/wxpython/core/utils.py
r73903 r73930 27 27 from grass.exceptions import OpenError 28 28 29 from core import globalvar30 29 from core.gcmd import RunCommand 31 30 from core.debug import Debug 32 33 try: 34 # intended to be used also outside this module 35 import gettext 36 _ = gettext.translation( 37 'grasswxpy', 38 os.path.join( 39 os.getenv("GISBASE"), 40 'locale')).ugettext 41 except IOError: 42 # using no translation silently 43 def null_gettext(string): 44 return string 45 _ = null_gettext 46 31 from core.globalvar import ETCDIR, wxPythonPhoenix, _ 47 32 48 33 def cmp(a, b): … … 841 826 """ 842 827 try: 843 verFd = open(os.path.join( globalvar.ETCDIR, "VERSIONNUMBER"))828 verFd = open(os.path.join(ETCDIR, "VERSIONNUMBER")) 844 829 version = int(verFd.readlines()[0].split(' ')[0].split('.')[0]) 845 830 except (IOError, ValueError, TypeError, IndexError) as e: … … 1098 1083 "tostring")) 1099 1084 # Create layer and insert alpha values. 1100 if globalvar.wxPythonPhoenix:1085 if wxPythonPhoenix: 1101 1086 wxImage.SetAlpha(fn()[3::4]) 1102 1087 else: -
grass/trunk/lib/python/script/core.py
r73906 r73930 73 73 kwargs['shell'] = True 74 74 args = [self._escape_for_shell(arg) for arg in args] 75 args = [decode(arg) for arg in args] 75 76 subprocess.Popen.__init__(self, args, **kwargs) 76 77 … … 209 210 path.insert(0, os.curdir) 210 211 211 # PATHEXT is necessary to check on Windows. 212 pathext = os.environ.get("PATHEXT", "").split(os.pathsep) 213 map(lambda x: x.lower(), pathext) # force lowercase 214 if '.py' not in pathext: # we assume that PATHEXT contains always '.py' 215 pathext.insert(0, '.py') 212 # PATHEXT is necessary to check on Windows (force lowercase) 213 pathext = list(map(lambda x: encode(x.lower()), 214 os.environ.get("PATHEXT", "").split(os.pathsep))) 215 if b'.py' not in pathext: 216 # we assume that PATHEXT contains always '.py' 217 pathext.insert(0, b'.py') 216 218 # See if the given file matches any of the expected path extensions. 217 219 # This will allow us to short circuit when given "python.exe". 218 220 # If it does match, only test that one, otherwise we have to try 219 221 # others. 220 if any(cmd.lower().endswith(ext .lower()) for ext in pathext):222 if any(cmd.lower().endswith(ext) for ext in pathext): 221 223 files = [cmd] 222 224 else: … … 233 235 seen.add(normdir) 234 236 for thefile in files: 235 name = os.path.join( dir, thefile)237 name = os.path.join(encode(dir), thefile) 236 238 if _access_check(name, mode): 237 239 return name
Note:
See TracChangeset
for help on using the changeset viewer.
