Skip to content

Commit 63a4e50

Browse files
author
stonebig
committed
accept binary wheels when building winpython
1 parent ea4fbe0 commit 63a4e50

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

make.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,9 +473,9 @@ def _install_required_packages(self):
473473

474474
# Install 'main packages' first (was before Wheel idea, keep for now)
475475
for happy_few in['numpy-MKL', 'scipy', 'matplotlib', 'pandas']:
476+
# can be a wheel now
476477
self.install_package(
477-
'%s-([0-9\.]*[a-z]*[0-9]?).%s(-py%s)?.exe'
478-
% (happy_few, self.py_arch, self.python_version))
478+
'%s-([0-9\.]*[a-z]*[0-9]?)(.*)(\.exe|\.whl)' % happy_few)
479479

480480
def _install_all_other_packages(self):
481481
"""Try to install all other packages in instdirs"""

winpython/utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,10 @@ def extract_archive(fname, targetdir=None, verbose=False):
352352

353353
SOURCE_PATTERN = r'([a-zA-Z0-9\-\_\.]*)-([0-9\.\_]*[a-z]*[0-9]?)(\.zip|\.tar\.gz|\-[a-z\.0-9]*\-none\-any\.whl)'
354354

355+
# WHEELBIN_PATTERN defines what an acceptable binary wheel package is
356+
# "cp([0-9]*)" to replace per cp(34) for python3.4
357+
# "win32|win\_amd64" to replace per "win\_amd64" for 64bit
358+
WHEELBIN_PATTERN = r'([a-zA-Z0-9\-\_\.]*)-([0-9\.\_]*[a-z]*[0-9]?)-cp([0-9]*)\-none\-(win32|win\_amd64)\.whl'
355359

356360
def get_source_package_infos(fname):
357361
"""Return a tuple (name, version) of the Python source package"""
@@ -373,7 +377,7 @@ def build_wininst(root, python_exe=None, copy_to=None,
373377
archstr = 'win32' if architecture == 32 else 'win-amd64'
374378
cmd += ['--plat-name=%s' % archstr]
375379
cmd += ['bdist_wininst']
376-
# print('build_wininst', root, cmd)
380+
# root = a tmp dir in windows\tmp,
377381
if verbose:
378382
subprocess.call(cmd, cwd=root)
379383
else:
@@ -406,6 +410,8 @@ def build_wininst(root, python_exe=None, copy_to=None,
406410
shutil.move(src_fname, dst_fname)
407411
if verbose:
408412
print(("Move: %s --> %s" % (src_fname, (dst_fname))))
413+
# remove tempo dir 'root' no more needed
414+
shutil.rmtree(root, onerror=onerror)
409415
return dst_fname
410416

411417

winpython/wppm.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,17 @@ def extract_infos(self):
128128
self.name, self.version, self.pyversion, arch, _pyqt = match.groups()
129129
self.architecture = int(arch)
130130
return
131+
# New : Binary wheel case
132+
elif bname.endswith(('32.whl', '64.whl')):
133+
match = re.match(utils.WHEELBIN_PATTERN, bname)
134+
# typical macht is ('scipy', '0.14.1rc1', '34', 'win32')
135+
if match is not None:
136+
self.name, self.version, self.pywheel , arch = match.groups()
137+
# self.pywheel version is '34' not 3.4
138+
self.pyversion = self.pywheel[:1] + '.' + self.pywheel[1:]
139+
# wheel arch is 'win32' or 'win_amd64'
140+
self.architecture = 32 if arch == 'win32' else 64
141+
return
131142
elif bname.endswith(('.zip', '.tar.gz', '.whl')):
132143
# distutils sdist
133144
infos = utils.get_source_package_infos(bname)

0 commit comments

Comments
 (0)