Browse Source

Merge pull request #620 from commodo/python3-update

Python3 update
lilik-openwrt-22.03
Steven Barth 10 years ago
parent
commit
91df26017a
2 changed files with 25 additions and 1 deletions
  1. +3
    -1
      lang/python3/files/python3-package.mk
  2. +22
    -0
      lang/python3/patches/140-do-not-write-bytes-codes.patch

+ 3
- 1
lang/python3/files/python3-package.mk View File

@ -20,7 +20,8 @@ PYTHON3:=python$(PYTHON3_VERSION)
HOST_PYTHON3_LIB_DIR:=$(STAGING_DIR_HOST)/lib/python$(PYTHON3_VERSION)
HOST_PYTHON3_BIN:=$(STAGING_DIR_HOST)/bin/python3
PYTHON3PATH="$(PYTHON3_LIB_DIR):$(STAGING_DIR)/$(PYTHON3_PKG_DIR)"
PYTHON3PATH:=$(PYTHON3_LIB_DIR):$(STAGING_DIR)/$(PYTHON3_PKG_DIR)
PYTHON3PATH+=:$(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR)
define HostPython3
( export PYTHONPATH="$(PYTHON3PATH)"; \
export PYTHONOPTIMIZE=""; \
@ -79,6 +80,7 @@ endef
# $(2) => additional arguments to setup.py
# $(3) => additional variables
define Build/Compile/Py3Mod
$(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR)
$(call HostPython3, \
cd $(PKG_BUILD_DIR)/$(strip $(1)); \
CC="$(TARGET_CC)" \


+ 22
- 0
lang/python3/patches/140-do-not-write-bytes-codes.patch View File

@ -0,0 +1,22 @@
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 0327830..df41cda 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -124,7 +124,7 @@ int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */
int Py_InspectFlag; /* Needed to determine whether to exit at SystemExit */
int Py_NoSiteFlag; /* Suppress 'import site' */
int Py_BytesWarningFlag; /* Warn on str(bytes) and str(buffer) */
-int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.py[co]) */
+int Py_DontWriteBytecodeFlag = 1; /* Suppress writing bytecode files (*.py[co]) */
int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */
int Py_FrozenFlag; /* Needed by getpath.c */
int Py_IgnoreEnvironmentFlag; /* e.g. PYTHONPATH, PYTHONHOME */
@@ -350,7 +350,7 @@ _Py_InitializeEx_Private(int install_sigs, int install_importlib)
if ((p = Py_GETENV("PYTHONOPTIMIZE")) && *p != '\0')
Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p);
if ((p = Py_GETENV("PYTHONDONTWRITEBYTECODE")) && *p != '\0')
- Py_DontWriteBytecodeFlag = add_flag(Py_DontWriteBytecodeFlag, p);
+ Py_DontWriteBytecodeFlag = atoi(p);
/* The variable is only tested for existence here; _PyRandom_Init will
check its value further. */
if ((p = Py_GETENV("PYTHONHASHSEED")) && *p != '\0')

Loading…
Cancel
Save