Commits

Anonymous committed f417089

Fixing #200

  • Participants
  • Parent commits 2220741
  • Branches 0.6-maintenance

Comments (0)

Files changed (3)

setuptools/command/easy_install.py

 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, \
         # 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

setuptools/package_index.py

     """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)
         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.)

setuptools/tests/test_packageindex.py

         # 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'))