python,python3: Disable user site-packages for host Python 9100/head
authorJeffery To <jeffery.to@gmail.com>
Wed, 29 May 2019 14:03:18 +0000 (22:03 +0800)
committerJeffery To <jeffery.to@gmail.com>
Wed, 29 May 2019 14:03:18 +0000 (22:03 +0800)
Normally, Python will include the user's site-packages directory
(~/.local/lib/python$(PYTHON_VERSION)/site-packages) in it's internal
search path for modules.

This disables this default inclusion for host Python.

This change is applied during Host/Configure instead of as a patch to
keep this setting unchanged for target Python.

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
lang/python/python/Makefile
lang/python/python3/Makefile

index 979ccc7714871ebbf58fb8af9c4b2000265c37a0..c59e6a940c6ec184728fdad785934b5f0e7f1c45 100644 (file)
@@ -298,6 +298,11 @@ HOST_CONFIGURE_ARGS+= \
        --with-ensurepip=install \
        CONFIG_SITE=
 
+define Host/Configure
+       $(SED) 's/^ENABLE_USER_SITE = None$$$$/ENABLE_USER_SITE = False/' $(HOST_BUILD_DIR)/Lib/site.py
+       $(call Host/Configure/Default)
+endef
+
 define Host/Compile
        $(call Host/Compile/Default,python Parser/pgen sharedmods)
 endef
index d151459ed891259131038d2791a5e8d19180a395..d2aea17f64a576b81736c1937288737432daf39f 100644 (file)
@@ -292,6 +292,11 @@ HOST_CONFIGURE_ARGS+= \
        --with-ensurepip=install \
        CONFIG_SITE=
 
+define Host/Configure
+       $(SED) 's/^ENABLE_USER_SITE = None$$$$/ENABLE_USER_SITE = False/' $(HOST_BUILD_DIR)/Lib/site.py
+       $(call Host/Configure/Default)
+endef
+
 define Host/Compile
        +$(HOST_MAKE_VARS) $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) python Parser/pgen
        +$(HOST_MAKE_VARS) $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) sharedmods