-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Borrowed from p4a: kivy/python-for-android#2159 Also refs upstream issue: https://bugs.python.org/issue40261 Note that the fix used upstream cannot really be used directly here because the actual system Python is impacted. Adds venv build to CI to check for regressions.
- Loading branch information
1 parent
10e3a0c
commit ab2b3ce
Showing
9 changed files
with
113 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,20 @@ | ||
from toolchain import Recipe, shprint | ||
from os.path import join | ||
from toolchain import Recipe, shprint, cd, cache_execution | ||
import sh | ||
import os | ||
import shutil | ||
|
||
|
||
class HostSetuptools3(Recipe): | ||
depends = ["openssl", "hostpython3"] | ||
archs = ["x86_64"] | ||
url = "setuptools" | ||
version = '40.9.0' | ||
url = 'https://pypi.python.org/packages/source/s/setuptools/setuptools-{version}.zip' | ||
|
||
def prebuild_arch(self, arch): | ||
@cache_execution | ||
def install(self): | ||
arch = self.filtered_archs[0] | ||
build_dir = self.get_build_dir(arch.arch) | ||
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, 'hostpython3', | ||
'lib', 'python3.8', 'site-packages') | ||
os.chdir(site_packages_path) | ||
with open('setuptools.pth', 'r') as f: | ||
setuptools_egg_path = f.read().strip('./').strip('\n') | ||
print("setuptools_egg_path=", setuptools_egg_path) | ||
unzip = sh.Command('unzip') | ||
shprint(unzip, "-o", setuptools_egg_path) | ||
os.remove(setuptools_egg_path) | ||
os.remove('setuptools.pth') | ||
os.remove('easy-install.pth') | ||
shutil.rmtree('EGG-INFO') | ||
with cd(build_dir): | ||
shprint(hostpython, "setup.py", "install") | ||
|
||
|
||
recipe = HostSetuptools3() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
diff -Nru Python-3.8.2/Lib/site.py Python-3.8.2-new/Lib/site.py | ||
--- Python-3.8.2/Lib/site.py 2020-02-24 22:36:25.000000000 +0100 | ||
+++ Python-3.8.2-new/Lib/site.py 2020-05-01 17:10:43.000000000 +0200 | ||
@@ -458,9 +458,8 @@ | ||
|
||
env = os.environ | ||
if sys.platform == 'darwin' and '__PYVENV_LAUNCHER__' in env: | ||
- executable = sys._base_executable = os.environ['__PYVENV_LAUNCHER__'] | ||
- else: | ||
- executable = sys.executable | ||
+ print("Ignoring __PYVENV_LAUNCHER__") | ||
+ executable = sys.executable | ||
exe_dir, _ = os.path.split(os.path.abspath(executable)) | ||
site_prefix = os.path.dirname(exe_dir) | ||
sys._home = None | ||
@@ -487,7 +486,8 @@ | ||
if key == 'include-system-site-packages': | ||
system_site = value.lower() | ||
elif key == 'home': | ||
- sys._home = value | ||
+ # this is breaking pyconfig.h path detection with venv | ||
+ print('Ignoring "sys._home = value" override') | ||
|
||
sys.prefix = sys.exec_prefix = site_prefix | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
diff -Nru Python-3.8.2/Lib/site.py Python-3.8.2-new/Lib/site.py | ||
--- Python-3.8.2/Lib/site.py 2020-02-24 22:36:25.000000000 +0100 | ||
+++ Python-3.8.2-new/Lib/site.py 2020-05-01 17:10:43.000000000 +0200 | ||
@@ -458,9 +458,8 @@ | ||
|
||
env = os.environ | ||
if sys.platform == 'darwin' and '__PYVENV_LAUNCHER__' in env: | ||
- executable = sys._base_executable = os.environ['__PYVENV_LAUNCHER__'] | ||
- else: | ||
- executable = sys.executable | ||
+ print("Ignoring __PYVENV_LAUNCHER__") | ||
+ executable = sys.executable | ||
exe_dir, _ = os.path.split(os.path.abspath(executable)) | ||
site_prefix = os.path.dirname(exe_dir) | ||
sys._home = None | ||
@@ -487,7 +486,8 @@ | ||
if key == 'include-system-site-packages': | ||
system_site = value.lower() | ||
elif key == 'home': | ||
- sys._home = value | ||
+ # this is breaking pyconfig.h path detection with venv | ||
+ print('Ignoring "sys._home = value" override') | ||
|
||
sys.prefix = sys.exec_prefix = site_prefix | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters