From 7f7327014c3225e43ddc43cee6b8505c5dd79cfa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tarek=20Ziad=C3=A9?= Date: Tue, 13 Oct 2009 21:17:34 +0000 Subject: [PATCH] complementary fix for #7115 --- Lib/distutils/command/build_ext.py | 6 ++++-- Lib/distutils/tests/test_build_ext.py | 13 +++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py index abc1584180..8248089fec 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -628,8 +628,10 @@ class build_ext (Command): 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) diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py index 5dffe2ca03..93d18814bc 100644 --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -373,6 +373,19 @@ class BuildExtTestCase(support.TempdirManager, 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: -- 2.50.1