Commit 9c6be7ac authored by Guy Rozendorn's avatar Guy Rozendorn

Testing for 64bit by using struct, same way as distribute does

parent fe54eb2d
...@@ -30,6 +30,7 @@ import setuptools.archive_util ...@@ -30,6 +30,7 @@ import setuptools.archive_util
import setuptools.command.setopt import setuptools.command.setopt
import setuptools.package_index import setuptools.package_index
import shutil import shutil
import struct
import subprocess import subprocess
import sys import sys
import tempfile import tempfile
...@@ -51,6 +52,7 @@ logger = logging.getLogger('zc.buildout.easy_install') ...@@ -51,6 +52,7 @@ logger = logging.getLogger('zc.buildout.easy_install')
url_match = re.compile('[a-z0-9+.-]+://').match url_match = re.compile('[a-z0-9+.-]+://').match
is_win32 = sys.platform == 'win32' is_win32 = sys.platform == 'win32'
is_64 = struct.calcsize("P") == 8
is_jython = sys.platform.startswith('java') is_jython = sys.platform.startswith('java')
is_distribute = ( is_distribute = (
pkg_resources.Requirement.parse('setuptools').key=='distribute') pkg_resources.Requirement.parse('setuptools').key=='distribute')
...@@ -1460,7 +1462,7 @@ def _write_script(full_name, contents, logged_type): ...@@ -1460,7 +1462,7 @@ def _write_script(full_name, contents, logged_type):
script_name += '-script.py' script_name += '-script.py'
# Generate exe file and give the script a magic name. # Generate exe file and give the script a magic name.
exe = full_name + '.exe' exe = full_name + '.exe'
new_data = pkg_resources.resource_string('setuptools', 'cli-64.exe' if sys.maxsize > 2**32 else 'cli-32.exe') new_data = pkg_resources.resource_string('setuptools', 'cli-64.exe' if is_64 else 'cli-32.exe')
if not os.path.exists(exe) or (open(exe, 'rb').read() != new_data): if not os.path.exists(exe) or (open(exe, 'rb').read() != new_data):
# Only write it if it's different. # Only write it if it's different.
open(exe, 'wb').write(new_data) open(exe, 'wb').write(new_data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment