Author: Philip Jenvey <pjen...@underboss.org> Branch: py3k Changeset: r70519:7eafa2968379 Date: 2014-04-09 11:58 -0700 http://bitbucket.org/pypy/pypy/changeset/7eafa2968379/
Log: merge default diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py --- a/pypy/module/posix/test/test_posix2.py +++ b/pypy/module/posix/test/test_posix2.py @@ -333,7 +333,6 @@ if sys.platform != "win32": assert not posix.access(pdir, posix.X_OK) - def test_times(self): """ posix.times() should return a five-tuple giving float-representations @@ -1099,8 +1098,8 @@ res = os.system(cmd) assert res == 0 + class AppTestPosixUnicode: - def setup_class(cls): cls.space = space cls.w_posix = space.appexec([], GET_POSIX) @@ -1141,6 +1140,7 @@ except OSError: pass + class AppTestUnicodeFilename: def setup_class(cls): ufilename = (unicode(udir.join('test_unicode_filename_')) + diff --git a/pypy/module/sys/initpath.py b/pypy/module/sys/initpath.py --- a/pypy/module/sys/initpath.py +++ b/pypy/module/sys/initpath.py @@ -13,7 +13,9 @@ from pypy.interpreter.gateway import unwrap_spec from pypy.module.sys.state import get as get_state -IS_WINDOWS = sys.platform == 'win32' +PLATFORM = sys.platform +_MACOSX = sys.platform == 'darwin' +_WIN32 = sys.platform == 'win32' def find_executable(executable): @@ -21,10 +23,10 @@ Return the absolute path of the executable, by looking into PATH and the current directory. If it cannot be found, return ''. """ - if (we_are_translated() and IS_WINDOWS and + if (we_are_translated() and _WIN32 and not executable.lower().endswith('.exe')): executable += '.exe' - if os.sep in executable or (IS_WINDOWS and ':' in executable): + if os.sep in executable or (_WIN32 and ':' in executable): # the path is already more than just an executable name pass else: @@ -43,7 +45,7 @@ def _readlink_maybe(filename): - if not IS_WINDOWS: + if not _WIN32: return os.readlink(filename) raise NotImplementedError @@ -115,9 +117,9 @@ importlist.append(lib_tk) # List here the extra platform-specific paths. - if not IS_WINDOWS: - importlist.append(os.path.join(python_std_lib, 'plat-' + sys.platform)) - if sys.platform == 'darwin': + if not _WIN32: + importlist.append(os.path.join(python_std_lib, 'plat-' + PLATFORM)) + if _MACOSX: platmac = os.path.join(python_std_lib, 'plat-mac') importlist.append(platmac) importlist.append(os.path.join(platmac, 'lib-scriptpackages')) @@ -150,7 +152,7 @@ path, prefix = find_stdlib(get_state(space), executable) if path is None: return space.w_None - space.setitem(space.sys.w_dict, space.wrap('prefix'), space.wrap(prefix)) - space.setitem(space.sys.w_dict, space.wrap('exec_prefix'), - space.wrap(prefix)) + w_prefix = space.wrap(prefix) + space.setitem(space.sys.w_dict, space.wrap('prefix'), w_prefix) + space.setitem(space.sys.w_dict, space.wrap('exec_prefix'), w_prefix) return space.newlist([space.wrap(p) for p in path]) diff --git a/pypy/module/sys/test/test_initpath.py b/pypy/module/sys/test/test_initpath.py --- a/pypy/module/sys/test/test_initpath.py +++ b/pypy/module/sys/test/test_initpath.py @@ -84,7 +84,7 @@ assert find_executable('pypy') == a.join('pypy') # monkeypatch.setattr(initpath, 'we_are_translated', lambda: True) - monkeypatch.setattr(initpath, 'IS_WINDOWS', True) + monkeypatch.setattr(initpath, '_WIN32', True) monkeypatch.setenv('PATH', str(a)) a.join('pypy.exe').ensure(file=True) assert find_executable('pypy') == a.join('pypy.exe') _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit