Avoid errors from setuptools if installed as egg with .pth mapping on subsequent package installs with hostpython
This commit is contained in:
parent
e9ac3c9be7
commit
7cca79030a
1 changed files with 16 additions and 1 deletions
|
@ -7,7 +7,7 @@ import shutil
|
|||
|
||||
|
||||
class HostSetuptools(Recipe):
|
||||
depends = ["hostpython"]
|
||||
depends = ["openssl", "hostpython"]
|
||||
archs = ["x86_64"]
|
||||
url = "setuptools"
|
||||
|
||||
|
@ -15,5 +15,20 @@ class HostSetuptools(Recipe):
|
|||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
sh.curl("-O", "https://bootstrap.pypa.io/ez_setup.py")
|
||||
shprint(hostpython, "./ez_setup.py")
|
||||
# Extract setuptools egg and remove .pth files. Otherwise subsequent
|
||||
# python package installations using setuptools will raise exceptions.
|
||||
# Setuptools version 28.3.0
|
||||
site_packages_path = join(
|
||||
self.ctx.dist_dir, 'hostpython',
|
||||
'lib', 'python2.7', 'site-packages')
|
||||
os.chdir(site_packages_path)
|
||||
with open('setuptools.pth', 'r') as f:
|
||||
setuptools_egg_path = f.read().strip('./').strip('\n')
|
||||
unzip = sh.Command('unzip')
|
||||
shprint(unzip, setuptools_egg_path)
|
||||
os.remove(setuptools_egg_path)
|
||||
os.remove('setuptools.pth')
|
||||
os.remove('easy-install.pth')
|
||||
shutil.rmtree('EGG-INFO')
|
||||
|
||||
recipe = HostSetuptools()
|
||||
|
|
Loading…
Add table
Reference in a new issue