<Hermetic> Build Python2.7 statically using Soong.
1. Build Python2.7 statically (for sys libs, still dynamically get
linked) for Linux-x86-64 host.
2. Fixed a small build issue for _testcapi.
Modules/config.c is checked-in as source file. Ideally it can be
generated by parsing Android.bp file with some genrule.
Linux/pyconfig.h is for x86-64bit. For arm versioin, another pyconfig.h
will be checked-in under "Arm" dir.
Module: _ctypes is not contained within this patch. I am still trying to
figure out how the libffi works. Or we maybe use .swig directly.
For .py std libs, this static interpreter depends on /usr/lib/python2.7
for now.
Next step: pack up .py std libs, and bundle with this static
interpreter.
Test: cd out/host/linux-x86/bin/python2.7;./python -S
Bug: b/38395161
Change-Id: I680b120c1e056ff3589e8b4faa836bb204210437
diff --git a/Lib/site.py b/Lib/site.py
index 3b51e81..d09cda3 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -203,6 +203,10 @@
False: Disabled by user (command line option)
True: Safe and enabled
"""
+ # GOOGLE(nanzhang): Don't enable user-site directories,
+ # everything's supposed to be hermetic.
+ return None
+
if sys.flags.no_user_site:
return False
@@ -518,7 +522,9 @@
known_paths = removeduppaths()
if ENABLE_USER_SITE is None:
ENABLE_USER_SITE = check_enableusersite()
- known_paths = addusersitepackages(known_paths)
+ if ENABLE_USER_SITE:
+ known_paths = addusersitepackages(known_paths)
+
known_paths = addsitepackages(known_paths)
if sys.platform == 'os2emx':
setBEGINLIBPATH()