[Python-checkins] r75395 - in python/branches/release26-maint/Lib/distutils: command/build_ext.py tests/test_build_ext.py

tarek.ziade python-checkins at python.org
Tue Oct 13 23:17:34 CEST 2009


Author: tarek.ziade
Date: Tue Oct 13 23:17:34 2009
New Revision: 75395

Log:
complementary fix for #7115

Modified:
   python/branches/release26-maint/Lib/distutils/command/build_ext.py
   python/branches/release26-maint/Lib/distutils/tests/test_build_ext.py

Modified: python/branches/release26-maint/Lib/distutils/command/build_ext.py
==============================================================================
--- python/branches/release26-maint/Lib/distutils/command/build_ext.py	(original)
+++ python/branches/release26-maint/Lib/distutils/command/build_ext.py	Tue Oct 13 23:17:34 2009
@@ -628,8 +628,10 @@
         The file is located in `build_lib` or directly in the package
         (inplace option).
         """
-        if os.sep in ext_name:
-            ext_name = ext_name.replace(os.sep, '.')
+        # makes sure the extension name is only using dots
+        all_dots = string.maketrans('/'+os.sep, '..')
+        ext_name = ext_name.translate(all_dots)
+
         fullname = self.get_ext_fullname(ext_name)
         modpath = fullname.split('.')
         filename = self.get_ext_filename(ext_name)

Modified: python/branches/release26-maint/Lib/distutils/tests/test_build_ext.py
==============================================================================
--- python/branches/release26-maint/Lib/distutils/tests/test_build_ext.py	(original)
+++ python/branches/release26-maint/Lib/distutils/tests/test_build_ext.py	Tue Oct 13 23:17:34 2009
@@ -373,6 +373,19 @@
         wanted = os.path.join(cmd.build_lib, 'UpdateManager', 'fdsend' + ext)
         self.assertEquals(ext_path, wanted)
 
+    def test_build_ext_path_cross_platform(self):
+        if sys.platform != 'win32':
+            return
+        dist = Distribution({'name': 'UpdateManager'})
+        cmd = build_ext(dist)
+        cmd.ensure_finalized()
+        ext = sysconfig.get_config_var("SO")
+        # this needs to work even under win32
+        ext_name = 'UpdateManager/fdsend'
+        ext_path = cmd.get_ext_fullpath(ext_name)
+        wanted = os.path.join(cmd.build_lib, 'UpdateManager', 'fdsend' + ext)
+        self.assertEquals(ext_path, wanted)
+
 def test_suite():
     if not sysconfig.python_build:
         if test_support.verbose:


More information about the Python-checkins mailing list