Commits

Adam Groszer committed 1d3923b

hopefully solved win-amd64 issues, where an .exe for the platform
could not be installed, because it was not recognized

Comments (0)

Files changed (6)

setuptools/cli_64.exe

Binary file added.

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
             ) % locals()
             if sys.platform=='win32' or wininst:
                 # On Windows/wininst, add a .py extension and an .exe launcher
+                plat = get_platform()
                 if group=='gui_scripts':
-                    ext, launcher = '-script.pyw', 'gui.exe'
+                    if 'amd64' in plat:
+                        ext, launcher = '-script.pyw', 'gui_64.exe'
+                    else:
+                        ext, launcher = '-script.pyw', 'gui.exe'
                     old = ['.pyw']
                     new_header = re.sub('(?i)python.exe','pythonw.exe',header)
                 else:
-                    ext, launcher = '-script.py', 'cli.exe'
+                    if 'amd64' in plat:
+                        ext, launcher = '-script.py', 'cli_64.exe'
+                    else:
+                        ext, launcher = '-script.py', 'cli.exe'
                     old = ['.py','.pyc','.pyo']
                     new_header = re.sub('(?i)pythonw.exe','python.exe',header)
 

setuptools/gui_64.exe

Binary file added.

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
+    return base,py_ver,plat
 
 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

         )
         url = 'file:///tmp/test_package_index'
         self.assert_(index.url_ok(url, True))
+       
+    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'))
 
     def test_links_priority(self):
         """

setuptools/tests/win_script_wrapper.txt

 
 We'll also copy cli.exe to the sample-directory with the name foo.exe:
 
+    >>> from distutils.util import get_platform
+    >>> plat = get_platform()
+    >>> if 'amd64' in plat:
+    ...     launcher = 'cli_64.exe'
+    ... else:
+    ...     launcher = 'cli.exe'
+
     >>> import pkg_resources
     >>> open(os.path.join(sample_directory, 'foo.exe'), 'wb').write(
-    ...     pkg_resources.resource_string('setuptools', 'cli.exe')
+    ...     pkg_resources.resource_string('setuptools', launcher)
     ...     )
 
 When the copy of cli.exe, foo.exe in this example, runs, it examines
 the path name it was run with and computes a Python script path name
 by removing the '.exe' suffic and adding the '-script.py' suffix. (For
 GUI programs, the suffix '-script-pyw' is added.)  This is why we
-named out script the way we did.  Now we can run out script by running
+named our script the way we did.  Now we can run our script by running
 the wrapper:
 
     >>> import os
 
 We'll also copy gui.exe to the sample-directory with the name bar.exe:
 
+    >>> plat = get_platform()
+    >>> if 'amd64' in plat:
+    ...     launcher = 'gui_64.exe'
+    ... else:
+    ...     launcher = 'gui.exe'
+
     >>> import pkg_resources
     >>> open(os.path.join(sample_directory, 'bar.exe'), 'wb').write(
-    ...     pkg_resources.resource_string('setuptools', 'gui.exe')
+    ...     pkg_resources.resource_string('setuptools', launcher)
     ...     )
 
 Finally, we'll run the script and check the result: