X Tutup
Skip to content

Commit cdd38ca

Browse files
committed
Wheel integration via control panel
1 parent 76af5a2 commit cdd38ca

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

winpython/controlpanel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,8 @@ def add_packages(self):
600600
"""Add packages"""
601601
basedir = self.basedir if self.basedir is not None else ''
602602
fnames, _selfilter = getopenfilenames(parent=self, basedir=basedir,
603-
caption='Add packages', filters='*.exe *.zip *.tar.gz')
603+
caption='Add packages',
604+
filters='*.exe *.zip *.tar.gz *.whl')
604605
if fnames:
605606
self.basedir = osp.dirname(fnames[0])
606607
self.table.add_packages(fnames)

winpython/wppm.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ class Package(BasePackage):
9292
def __init__(self, fname):
9393
BasePackage.__init__(self, fname)
9494
self.files = []
95-
9695
self.extract_infos()
9796
self.extract_optional_infos()
9897

@@ -127,7 +126,7 @@ def extract_infos(self):
127126
self.name, self.version, self.pyversion, arch, _pyqt = match.groups()
128127
self.architecture = int(arch)
129128
return
130-
elif bname.endswith(('.zip', '.tar.gz')):
129+
elif bname.endswith(('.zip', '.tar.gz', '.whl')):
131130
# distutils sdist
132131
infos = utils.get_source_package_infos(bname)
133132
if infos is not None:
@@ -322,7 +321,7 @@ def uninstall_existing(self, package):
322321
if pack is not None:
323322
self.uninstall(pack)
324323

325-
def install(self, package):
324+
def install(self, package, install_options=None):
326325
"""Install package in distribution"""
327326
assert package.is_compatible_with(self)
328327
tmp_fname = None
@@ -340,6 +339,10 @@ def install(self, package):
340339
tmp_fname = fname
341340
package = Package(fname)
342341
self._print_done()
342+
# wheel addition
343+
if package.fname.endswith(('.whl')):
344+
self.install_bdist_wheel(package, install_options=install_options)
345+
343346
bname = osp.basename(package.fname)
344347
if bname.endswith('.exe'):
345348
if re.match(r'(' + ('|'.join(self.NSIS_PACKAGES)) + r')-', bname):
@@ -451,6 +454,23 @@ def install_bdist_wininst(self, package):
451454
self.copy_files(package, targetdir, 'DATA', '.')
452455
self._print_done()
453456

457+
def install_bdist_wheel(self, package, install_options=None):
458+
"""Install a wheel directly !"""
459+
self._print(package, "Installing Wheel")
460+
#targetdir = utils.extract_msi(package.fname, targetdir=self.target)
461+
try:
462+
fname = utils.wheel_to_wininst(package.fname,
463+
python_exe=osp.join(self.target, 'python.exe'),
464+
architecture=self.architecture, verbose=self.verbose,
465+
install_options=install_options)
466+
except RuntimeError:
467+
if not self.verbose:
468+
print("Failed!")
469+
raise
470+
package = Package(fname)
471+
self._print_done()
472+
473+
454474
def install_bdist_msi(self, package):
455475
"""Install a distutils package built with the bdist_msi option
456476
(binary distribution, .msi file)"""

0 commit comments

Comments
 (0)
X Tutup