diff options
Diffstat (limited to 'Lib/distutils')
-rw-r--r-- | Lib/distutils/__init__.py | 2 | ||||
-rw-r--r-- | Lib/distutils/command/bdist_msi.py | 1 | ||||
-rw-r--r-- | Lib/distutils/command/build_ext.py | 6 | ||||
-rw-r--r-- | Lib/distutils/command/install.py | 27 | ||||
-rw-r--r-- | Lib/distutils/file_util.py | 9 | ||||
-rw-r--r-- | Lib/distutils/sysconfig.py | 103 | ||||
-rw-r--r-- | Lib/distutils/tests/test_bdist_msi.py | 25 | ||||
-rw-r--r-- | Lib/distutils/tests/test_build.py | 55 | ||||
-rw-r--r-- | Lib/distutils/tests/test_build_ext.py | 19 | ||||
-rw-r--r--[-rwxr-xr-x] | Lib/distutils/tests/test_clean.py | 0 | ||||
-rw-r--r-- | Lib/distutils/tests/test_dep_util.py | 81 | ||||
-rw-r--r-- | Lib/distutils/tests/test_dist.py | 1 | ||||
-rw-r--r-- | Lib/distutils/tests/test_sysconfig.py | 11 | ||||
-rw-r--r-- | Lib/distutils/text_file.py | 5 | ||||
-rw-r--r-- | Lib/distutils/util.py | 9 |
15 files changed, 248 insertions, 106 deletions
diff --git a/Lib/distutils/__init__.py b/Lib/distutils/__init__.py index 6f55f01..49b6d51 100644 --- a/Lib/distutils/__init__.py +++ b/Lib/distutils/__init__.py @@ -15,5 +15,5 @@ __revision__ = "$Id$" # Updated automatically by the Python release process. # #--start constants-- -__version__ = "3.1.3" +__version__ = "3.2" #--end constants-- diff --git a/Lib/distutils/command/bdist_msi.py b/Lib/distutils/command/bdist_msi.py index 8a458d8..b11957a 100644 --- a/Lib/distutils/command/bdist_msi.py +++ b/Lib/distutils/command/bdist_msi.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (C) 2005, 2006 Martin von Löwis # Licensed to PSF under a Contributor Agreement. # The bdist_wininst command proper diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py index 502b39a..fb31648 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -754,9 +754,9 @@ class build_ext(Command): else: from distutils import sysconfig if sysconfig.get_config_var('Py_ENABLE_SHARED'): - template = "python%d.%d" - pythonlib = (template % - (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) + pythonlib = 'python{}.{}{}'.format( + sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff, + sys.abiflags) return ext.libraries + [pythonlib] else: return ext.libraries diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py index 2a905d9..bdc3a09 100644 --- a/Lib/distutils/command/install.py +++ b/Lib/distutils/command/install.py @@ -48,7 +48,7 @@ INSTALL_SCHEMES = { 'unix_prefix': { 'purelib': '$base/lib/python$py_version_short/site-packages', 'platlib': '$platbase/lib/python$py_version_short/site-packages', - 'headers': '$base/include/python$py_version_short/$dist_name', + 'headers': '$base/include/python$py_version_short$abiflags/$dist_name', 'scripts': '$base/bin', 'data' : '$base', }, @@ -60,14 +60,6 @@ INSTALL_SCHEMES = { 'data' : '$base', }, 'nt': WINDOWS_SCHEME, - 'mac': { - 'purelib': '$base/Lib/site-packages', - 'platlib': '$base/Lib/site-packages', - 'headers': '$base/Include/$dist_name', - 'scripts': '$base/Scripts', - 'data' : '$base', - }, - 'os2': { 'purelib': '$base/Lib/site-packages', 'platlib': '$base/Lib/site-packages', @@ -90,15 +82,8 @@ if HAS_USER_SITE: INSTALL_SCHEMES['unix_user'] = { 'purelib': '$usersite', 'platlib': '$usersite', - 'headers': '$userbase/include/python$py_version_short/$dist_name', - 'scripts': '$userbase/bin', - 'data' : '$userbase', - } - - INSTALL_SCHEMES['mac_user'] = { - 'purelib': '$usersite', - 'platlib': '$usersite', - 'headers': '$userbase/$py_version_short/include/$dist_name', + 'headers': + '$userbase/include/python$py_version_short$abiflags/$dist_name', 'scripts': '$userbase/bin', 'data' : '$userbase', } @@ -328,6 +313,11 @@ class install(Command): py_version = sys.version.split()[0] (prefix, exec_prefix) = get_config_vars('prefix', 'exec_prefix') + try: + abiflags = sys.abiflags + except AttributeError: + # sys.abiflags may not be defined on all platforms. + abiflags = '' self.config_vars = {'dist_name': self.distribution.get_name(), 'dist_version': self.distribution.get_version(), 'dist_fullname': self.distribution.get_fullname(), @@ -338,6 +328,7 @@ class install(Command): 'prefix': prefix, 'sys_exec_prefix': exec_prefix, 'exec_prefix': exec_prefix, + 'abiflags': abiflags, } if HAS_USER_SITE: diff --git a/Lib/distutils/file_util.py b/Lib/distutils/file_util.py index c36e712..e1eb932 100644 --- a/Lib/distutils/file_util.py +++ b/Lib/distutils/file_util.py @@ -130,15 +130,6 @@ def copy_file(src, dst, preserve_mode=1, preserve_times=1, update=0, if dry_run: return (dst, 1) - # On Mac OS, use the native file copy routine - if os.name == 'mac': - import macostools - try: - macostools.copy(src, dst, 0, preserve_times) - except os.error as exc: - raise DistutilsFileError( - "could not copy '%s' to '%s': %s" % (src, dst, exc.args[-1])) - # If linking (hard or symbolic), use the appropriate system call # (Unix only, of course, but that's the caller's responsibility) elif link == 'hard': diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py index 9842d26..897b7d6 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -11,7 +11,6 @@ Email: <fdrake@acm.org> __revision__ = "$Id$" -import io import os import re import sys @@ -25,7 +24,7 @@ EXEC_PREFIX = os.path.normpath(sys.exec_prefix) # Path to the base directory of the project. On Windows the binary may # live in project/PCBuild9. If we're dealing with an x64 Windows build, # it'll live in project/PCbuild/amd64. -project_base = os.path.dirname(os.path.realpath(sys.executable)) +project_base = os.path.dirname(os.path.abspath(sys.executable)) if os.name == "nt" and "pcbuild" in project_base[-8:].lower(): project_base = os.path.abspath(os.path.join(project_base, os.path.pardir)) # PC/VS7.1 @@ -49,6 +48,18 @@ def _python_build(): return False python_build = _python_build() +# Calculate the build qualifier flags if they are defined. Adding the flags +# to the include and lib directories only makes sense for an installation, not +# an in-source build. +build_flags = '' +try: + if not python_build: + build_flags = sys.abiflags +except AttributeError: + # It's not a configure-based build, so the sys module doesn't have + # this attribute, which is fine. + pass + def get_python_version(): """Return a string containing the major and minor Python version, leaving off the patchlevel. Sample return values could be '1.5' @@ -77,20 +88,16 @@ def get_python_inc(plat_specific=0, prefix=None): # the build directory may not be the source directory, we # must use "srcdir" from the makefile to find the "Include" # directory. - base = os.path.dirname(os.path.realpath(sys.executable)) + base = os.path.dirname(os.path.abspath(sys.executable)) if plat_specific: return base else: incdir = os.path.join(get_config_var('srcdir'), 'Include') return os.path.normpath(incdir) - return os.path.join(prefix, "include", "python" + get_python_version()) + python_dir = 'python' + get_python_version() + build_flags + return os.path.join(prefix, "include", python_dir) elif os.name == "nt": return os.path.join(prefix, "include") - elif os.name == "mac": - if plat_specific: - return os.path.join(prefix, "Mac", "Include") - else: - return os.path.join(prefix, "Include") elif os.name == "os2": return os.path.join(prefix, "Include") else: @@ -131,17 +138,6 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): return prefix else: return os.path.join(prefix, "Lib", "site-packages") - elif os.name == "mac": - if plat_specific: - if standard_lib: - return os.path.join(prefix, "Lib", "lib-dynload") - else: - return os.path.join(prefix, "Lib", "site-packages") - else: - if standard_lib: - return os.path.join(prefix, "Lib") - else: - return os.path.join(prefix, "Lib", "site-packages") elif os.name == "os2": if standard_lib: return os.path.join(prefix, "Lib") @@ -223,10 +219,10 @@ def get_config_h_filename(): def get_makefile_filename(): """Return full pathname of installed Makefile from the Python build.""" if python_build: - return os.path.join(os.path.dirname(os.path.realpath(sys.executable)), - "Makefile") + return os.path.join(os.path.dirname(sys.executable), "Makefile") lib_dir = get_python_lib(plat_specific=1, standard_lib=1) - return os.path.join(lib_dir, "config", "Makefile") + config_file = 'config-{}{}'.format(get_python_version(), build_flags) + return os.path.join(lib_dir, config_file, 'Makefile') def parse_config_h(fp, g=None): @@ -272,7 +268,7 @@ def parse_makefile(fn, g=None): used instead of a new dictionary. """ from distutils.text_file import TextFile - fp = TextFile(fn, strip_comments=1, skip_blanks=1, join_lines=1) + fp = TextFile(fn, strip_comments=1, skip_blanks=1, join_lines=1, errors="surrogateescape") if g is None: g = {} @@ -301,6 +297,12 @@ def parse_makefile(fn, g=None): else: done[n] = v + # Variables with a 'PY_' prefix in the makefile. These need to + # be made available without that prefix through sysconfig. + # Special care is needed to ensure that variable expansion works, even + # if the expansion uses the name without a prefix. + renamed_variables = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS') + # do variable interpolation here while notdone: for name in list(notdone): @@ -317,6 +319,16 @@ def parse_makefile(fn, g=None): elif n in os.environ: # do it like make: fall back to environment item = os.environ[n] + + elif n in renamed_variables: + if name.startswith('PY_') and name[3:] in renamed_variables: + item = "" + + elif 'PY_' + n in notdone: + found = False + + else: + item = str(done['PY_' + n]) else: done[n] = item = "" if found: @@ -331,12 +343,24 @@ def parse_makefile(fn, g=None): else: done[name] = value del notdone[name] + + if name.startswith('PY_') \ + and name[3:] in renamed_variables: + + name = name[3:] + if name not in done: + done[name] = value else: # bogus variable reference; just drop it since we can't deal del notdone[name] fp.close() + # strip spurious spaces + for k, v in done.items(): + if isinstance(v, str): + done[k] = v.strip() + # save the results in the global dictionary g.update(done) return g @@ -386,7 +410,8 @@ def _init_posix(): # load the installed pyconfig.h: try: filename = get_config_h_filename() - parse_config_h(io.open(filename), g) + with open(filename) as file: + parse_config_h(file, g) except IOError as msg: my_msg = "invalid Python installation: unable to open %s" % filename if hasattr(msg, "strerror"): @@ -443,34 +468,8 @@ def _init_nt(): g['SO'] = '.pyd' g['EXE'] = ".exe" g['VERSION'] = get_python_version().replace(".", "") - g['BINDIR'] = os.path.dirname(os.path.realpath(sys.executable)) - - global _config_vars - _config_vars = g - - -def _init_mac(): - """Initialize the module as appropriate for Macintosh systems""" - g = {} - # set basic install directories - g['LIBDEST'] = get_python_lib(plat_specific=0, standard_lib=1) - g['BINLIBDEST'] = get_python_lib(plat_specific=1, standard_lib=1) - - # XXX hmmm.. a normal install puts include files here - g['INCLUDEPY'] = get_python_inc(plat_specific=0) - - import MacOS - if not hasattr(MacOS, 'runtimemodel'): - g['SO'] = '.ppc.slb' - else: - g['SO'] = '.%s.slb' % MacOS.runtimemodel - - # XXX are these used anywhere? - g['install_lib'] = os.path.join(EXEC_PREFIX, "Lib") - g['install_platlib'] = os.path.join(EXEC_PREFIX, "Mac", "Lib") + g['BINDIR'] = os.path.dirname(os.path.abspath(sys.executable)) - # These are used by the extension module build - g['srcdir'] = ':' global _config_vars _config_vars = g diff --git a/Lib/distutils/tests/test_bdist_msi.py b/Lib/distutils/tests/test_bdist_msi.py new file mode 100644 index 0000000..9308c79 --- /dev/null +++ b/Lib/distutils/tests/test_bdist_msi.py @@ -0,0 +1,25 @@ +"""Tests for distutils.command.bdist_msi.""" +import unittest +import sys + +from test.support import run_unittest + +from distutils.tests import support + +@unittest.skipUnless(sys.platform=="win32", "These tests are only for win32") +class BDistMSITestCase(support.TempdirManager, + support.LoggingSilencer, + unittest.TestCase): + + def test_minimal(self): + # minimal test XXX need more tests + from distutils.command.bdist_msi import bdist_msi + pkg_pth, dist = self.create_dist() + cmd = bdist_msi(dist) + cmd.ensure_finalized() + +def test_suite(): + return unittest.makeSuite(BDistMSITestCase) + +if __name__ == '__main__': + run_unittest(test_suite()) diff --git a/Lib/distutils/tests/test_build.py b/Lib/distutils/tests/test_build.py new file mode 100644 index 0000000..3391f36 --- /dev/null +++ b/Lib/distutils/tests/test_build.py @@ -0,0 +1,55 @@ +"""Tests for distutils.command.build.""" +import unittest +import os +import sys +from test.support import run_unittest + +from distutils.command.build import build +from distutils.tests import support +from sysconfig import get_platform + +class BuildTestCase(support.TempdirManager, + support.LoggingSilencer, + unittest.TestCase): + + def test_finalize_options(self): + pkg_dir, dist = self.create_dist() + cmd = build(dist) + cmd.finalize_options() + + # if not specified, plat_name gets the current platform + self.assertEqual(cmd.plat_name, get_platform()) + + # build_purelib is build + lib + wanted = os.path.join(cmd.build_base, 'lib') + self.assertEqual(cmd.build_purelib, wanted) + + # build_platlib is 'build/lib.platform-x.x[-pydebug]' + # examples: + # build/lib.macosx-10.3-i386-2.7 + plat_spec = '.%s-%s' % (cmd.plat_name, sys.version[0:3]) + if hasattr(sys, 'gettotalrefcount'): + self.assertTrue(cmd.build_platlib.endswith('-pydebug')) + plat_spec += '-pydebug' + wanted = os.path.join(cmd.build_base, 'lib' + plat_spec) + self.assertEqual(cmd.build_platlib, wanted) + + # by default, build_lib = build_purelib + self.assertEqual(cmd.build_lib, cmd.build_purelib) + + # build_temp is build/temp.<plat> + wanted = os.path.join(cmd.build_base, 'temp' + plat_spec) + self.assertEqual(cmd.build_temp, wanted) + + # build_scripts is build/scripts-x.x + wanted = os.path.join(cmd.build_base, 'scripts-' + sys.version[0:3]) + self.assertEqual(cmd.build_scripts, wanted) + + # executable is os.path.normpath(sys.executable) + self.assertEqual(cmd.executable, os.path.normpath(sys.executable)) + +def test_suite(): + return unittest.makeSuite(BuildTestCase) + +if __name__ == "__main__": + run_unittest(test_suite()) diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py index 11844d6..dcba75f 100644 --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -1,17 +1,16 @@ import sys import os -import tempfile import shutil from io import StringIO -from distutils.core import Extension, Distribution +from distutils.core import Distribution from distutils.command.build_ext import build_ext from distutils import sysconfig from distutils.tests.support import TempdirManager from distutils.tests.support import LoggingSilencer from distutils.extension import Extension -from distutils.errors import (UnknownFileError, DistutilsSetupError, - CompileError) +from distutils.errors import ( + CompileError, DistutilsSetupError, UnknownFileError) import unittest from test import support @@ -256,7 +255,8 @@ class BuildExtTestCase(TempdirManager, cmd.finalize_options() #'extensions' option must be a list of Extension instances - self.assertRaises(DistutilsSetupError, cmd.check_extensions_list, 'foo') + self.assertRaises(DistutilsSetupError, + cmd.check_extensions_list, 'foo') # each element of 'ext_modules' option must be an # Extension instance or 2-tuple @@ -318,7 +318,7 @@ class BuildExtTestCase(TempdirManager, def test_get_outputs(self): tmp_dir = self.mkdtemp() c_file = os.path.join(tmp_dir, 'foo.c') - self.write_file(c_file, 'void PyInit_foo(void) {};\n') + self.write_file(c_file, 'void PyInit_foo(void) {}\n') ext = Extension('foo', [c_file], optional=False) dist = Distribution({'name': 'xx', 'ext_modules': [ext]}) @@ -345,8 +345,8 @@ class BuildExtTestCase(TempdirManager, finally: os.chdir(old_wd) self.assertTrue(os.path.exists(so_file)) - self.assertEqual(os.path.splitext(so_file)[-1], - sysconfig.get_config_var('SO')) + so_ext = sysconfig.get_config_var('SO') + self.assertTrue(so_file.endswith(so_ext)) so_dir = os.path.dirname(so_file) self.assertEqual(so_dir, other_tmp_dir) @@ -355,8 +355,7 @@ class BuildExtTestCase(TempdirManager, cmd.run() so_file = cmd.get_outputs()[0] self.assertTrue(os.path.exists(so_file)) - self.assertEqual(os.path.splitext(so_file)[-1], - sysconfig.get_config_var('SO')) + self.assertTrue(so_file.endswith(so_ext)) so_dir = os.path.dirname(so_file) self.assertEqual(so_dir, cmd.build_lib) diff --git a/Lib/distutils/tests/test_clean.py b/Lib/distutils/tests/test_clean.py index 649855f..649855f 100755..100644 --- a/Lib/distutils/tests/test_clean.py +++ b/Lib/distutils/tests/test_clean.py diff --git a/Lib/distutils/tests/test_dep_util.py b/Lib/distutils/tests/test_dep_util.py new file mode 100644 index 0000000..3e1c366 --- /dev/null +++ b/Lib/distutils/tests/test_dep_util.py @@ -0,0 +1,81 @@ +"""Tests for distutils.dep_util.""" +import unittest +import os +import time + +from distutils.dep_util import newer, newer_pairwise, newer_group +from distutils.errors import DistutilsFileError +from distutils.tests import support +from test.support import run_unittest + +class DepUtilTestCase(support.TempdirManager, unittest.TestCase): + + def test_newer(self): + + tmpdir = self.mkdtemp() + new_file = os.path.join(tmpdir, 'new') + old_file = os.path.abspath(__file__) + + # Raise DistutilsFileError if 'new_file' does not exist. + self.assertRaises(DistutilsFileError, newer, new_file, old_file) + + # Return true if 'new_file' exists and is more recently modified than + # 'old_file', or if 'new_file' exists and 'old_file' doesn't. + self.write_file(new_file) + self.assertTrue(newer(new_file, 'I_dont_exist')) + self.assertTrue(newer(new_file, old_file)) + + # Return false if both exist and 'old_file' is the same age or younger + # than 'new_file'. + self.assertFalse(newer(old_file, new_file)) + + def test_newer_pairwise(self): + tmpdir = self.mkdtemp() + sources = os.path.join(tmpdir, 'sources') + targets = os.path.join(tmpdir, 'targets') + os.mkdir(sources) + os.mkdir(targets) + one = os.path.join(sources, 'one') + two = os.path.join(sources, 'two') + three = os.path.abspath(__file__) # I am the old file + four = os.path.join(targets, 'four') + self.write_file(one) + self.write_file(two) + self.write_file(four) + + self.assertEqual(newer_pairwise([one, two], [three, four]), + ([one],[three])) + + def test_newer_group(self): + tmpdir = self.mkdtemp() + sources = os.path.join(tmpdir, 'sources') + os.mkdir(sources) + one = os.path.join(sources, 'one') + two = os.path.join(sources, 'two') + three = os.path.join(sources, 'three') + old_file = os.path.abspath(__file__) + + # return true if 'old_file' is out-of-date with respect to any file + # listed in 'sources'. + self.write_file(one) + self.write_file(two) + self.write_file(three) + self.assertTrue(newer_group([one, two, three], old_file)) + self.assertFalse(newer_group([one, two, old_file], three)) + + # missing handling + os.remove(one) + self.assertRaises(OSError, newer_group, [one, two, old_file], three) + + self.assertFalse(newer_group([one, two, old_file], three, + missing='ignore')) + + self.assertTrue(newer_group([one, two, old_file], three, + missing='newer')) + + +def test_suite(): + return unittest.makeSuite(DepUtilTestCase) + +if __name__ == "__main__": + run_unittest(test_suite()) diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py index 1624f00..a20d6c8 100644 --- a/Lib/distutils/tests/test_dist.py +++ b/Lib/distutils/tests/test_dist.py @@ -1,4 +1,3 @@ -# -*- coding: utf8 -*- """Tests for distutils.dist.""" import os import io diff --git a/Lib/distutils/tests/test_sysconfig.py b/Lib/distutils/tests/test_sysconfig.py index 41414bb..fbe26bf 100644 --- a/Lib/distutils/tests/test_sysconfig.py +++ b/Lib/distutils/tests/test_sysconfig.py @@ -83,7 +83,7 @@ class SysconfigTestCase(support.EnvironGuard, fd.close() d = sysconfig.parse_makefile(self.makefile) self.assertEqual(d, {'CONFIG_ARGS': "'--arg1=optarg1' 'ENV=LIB'", - 'OTHER': 'foo'}) + 'OTHER': 'foo'}) def test_parse_makefile_literal_dollar(self): self.makefile = TESTFN @@ -98,6 +98,15 @@ class SysconfigTestCase(support.EnvironGuard, 'OTHER': 'foo'}) + def test_sysconfig_module(self): + import sysconfig as global_sysconfig + self.assertEqual(global_sysconfig.get_config_var('CFLAGS'), sysconfig.get_config_var('CFLAGS')) + self.assertEqual(global_sysconfig.get_config_var('LDFLAGS'), sysconfig.get_config_var('LDFLAGS')) + self.assertEqual(global_sysconfig.get_config_var('LDSHARED'),sysconfig.get_config_var('LDSHARED')) + self.assertEqual(global_sysconfig.get_config_var('CC'), sysconfig.get_config_var('CC')) + + + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(SysconfigTestCase)) diff --git a/Lib/distutils/text_file.py b/Lib/distutils/text_file.py index 97459fb..454725c 100644 --- a/Lib/distutils/text_file.py +++ b/Lib/distutils/text_file.py @@ -58,6 +58,8 @@ class TextFile: collapse_join [default: false] strip leading whitespace from lines that are joined to their predecessor; only matters if (join_lines and not lstrip_ws) + errors [default: 'strict'] + error handler used to decode the file content Note that since 'rstrip_ws' can strip the trailing newline, the semantics of 'readline()' must differ from those of the builtin file @@ -72,6 +74,7 @@ class TextFile: 'rstrip_ws': 1, 'join_lines': 0, 'collapse_join': 0, + 'errors': 'strict', } def __init__(self, filename=None, file=None, **options): @@ -111,7 +114,7 @@ class TextFile: """Open a new file named 'filename'. This overrides both the 'filename' and 'file' arguments to the constructor.""" self.filename = filename - self.file = io.open(self.filename, 'r') + self.file = io.open(self.filename, 'r', errors=self.errors) self.current_line = 0 def close(self): diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py index 3081245..ce3cd6c 100644 --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -235,15 +235,6 @@ def change_root (new_root, pathname): path = path[1:] return os.path.join(new_root, path) - elif os.name == 'mac': - if not os.path.isabs(pathname): - return os.path.join(new_root, pathname) - else: - # Chop off volume name from start of path - elements = pathname.split(":", 1) - pathname = ":" + elements[1] - return os.path.join(new_root, pathname) - else: raise DistutilsPlatformError("nothing known about platform '%s'" % os.name) |