diff options
-rwxr-xr-x | setuptools/command/easy_install.py | 3 | ||||
-rwxr-xr-x | setuptools/package_index.py | 17 | ||||
-rw-r--r-- | setuptools/tests/test_packageindex.py | 9 |
3 files changed, 24 insertions, 5 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 20355341..fb0f9979 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -15,6 +15,7 @@ from glob import glob from setuptools import Command, _dont_write_bytecode from setuptools.sandbox import run_setup from distutils import log, dir_util +from distutils.util import get_platform from distutils.util import convert_path, subst_vars from distutils.sysconfig import get_python_lib, get_config_vars from distutils.errors import DistutilsArgError, DistutilsOptionError, \ @@ -854,7 +855,7 @@ Please make the appropriate changes for your system and try again. # Create a dummy distribution object until we build the real distro dist = Distribution(None, project_name=cfg.get('metadata','name'), - version=cfg.get('metadata','version'), platform="win32" + version=cfg.get('metadata','version'), platform=get_platform() ) # Convert the .exe to an unpacked egg diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 459cae2c..6d4047af 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -31,16 +31,25 @@ def parse_bdist_wininst(name): """Return (base,pyversion) or (None,None) for possible .exe name""" lower = name.lower() - base, py_ver = None, None + base, py_ver, plat = None, None, None if lower.endswith('.exe'): if lower.endswith('.win32.exe'): base = name[:-10] + plat = 'win32' elif lower.startswith('.win32-py',-16): py_ver = name[-7:-4] base = name[:-16] + plat = 'win32' + elif lower.endswith('.win-amd64.exe'): + base = name[:-14] + plat = 'win-amd64' + elif lower.startswith('.win-amd64-py',-20): + py_ver = name[-7:-4] + base = name[:-20] + plat = 'win-amd64' + return base,py_ver,plat - return base,py_ver def egg_info_for_url(url): scheme, server, path, parameters, query, fragment = urlparse.urlparse(url) @@ -69,10 +78,10 @@ def distros_for_location(location, basename, metadata=None): return [Distribution.from_location(location, basename, metadata)] if basename.endswith('.exe'): - win_base, py_ver = parse_bdist_wininst(basename) + win_base, py_ver, platform = parse_bdist_wininst(basename) if win_base is not None: return interpret_distro_name( - location, win_base, metadata, py_ver, BINARY_DIST, "win32" + location, win_base, metadata, py_ver, BINARY_DIST, platform ) # Try source distro extensions (.zip, .tgz, etc.) diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py index 42cb8c1e..00d44ca6 100644 --- a/setuptools/tests/test_packageindex.py +++ b/setuptools/tests/test_packageindex.py @@ -108,5 +108,14 @@ class TestPackageIndex(unittest.TestCase): # the link should be from the index self.assert_('correct_md5' in pi['foobar'][0].location) + def test_parse_bdist_wininst(self): + self.assertEqual(setuptools.package_index.parse_bdist_wininst( + 'reportlab-2.5.win32-py2.4.exe'), ('reportlab-2.5', '2.4', 'win32')) + self.assertEqual(setuptools.package_index.parse_bdist_wininst( + 'reportlab-2.5.win32.exe'), ('reportlab-2.5', None, 'win32')) + self.assertEqual(setuptools.package_index.parse_bdist_wininst( + 'reportlab-2.5.win-amd64-py2.7.exe'), ('reportlab-2.5', '2.7', 'win-amd64')) + self.assertEqual(setuptools.package_index.parse_bdist_wininst( + 'reportlab-2.5.win-amd64.exe'), ('reportlab-2.5', None, 'win-amd64')) |