Browse Source

Merge pull request #431 from commodo/python3-fix

Python3 fix
lilik-openwrt-22.03
sbyx 10 years ago
parent
commit
0dcfc24c04
2 changed files with 27 additions and 29 deletions
  1. +9
    -11
      lang/python3/Makefile
  2. +18
    -18
      lang/python3/files/python3-package.mk

+ 9
- 11
lang/python3/Makefile View File

@ -8,7 +8,10 @@
include $(TOPDIR)/rules.mk
# The file included below defines PYTHON_VERSION
-include $(if $(DUMP),,./files/python-package.mk)
include ./files/python3-package.mk
PYTHON_VERSION:=$(PYTHON3_VERSION)
PYTHON_VERSION_MICRO:=$(PYTHON3_VERSION_MICRO)
PKG_NAME:=python3
PKG_RELEASE:=1
@ -96,8 +99,6 @@ endif
define Build/Configure
-$(MAKE) -C $(PKG_BUILD_DIR) distclean
(cd $(PKG_BUILD_DIR); autoreconf --force --install || exit 0)
# The python executable needs to stay in the rootdir since its location will
# be used to compute the path of the config files.
$(CP) ./files/config.site $(PKG_BUILD_DIR)
$(call Build/Configure/Default, \
--sysconfdir=/etc \
@ -116,7 +117,7 @@ endef
define Build/InstallDev
$(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib
$(INSTALL_DIR) $(STAGING_DIR)/mk/
$(INSTALL_DATA) ./files/python-package.mk $(STAGING_DIR)/mk/
$(INSTALL_DATA) ./files/python3-package.mk $(STAGING_DIR)/mk/
$(CP) \
$(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
$(1)/usr/include/
@ -132,12 +133,9 @@ define Build/InstallDev
$(STAGING_DIR_HOST)/bin/python$(PYTHON_VERSION)-config \
$(2)/bin/
$(SED) 's,^#!.*,#!/usr/bin/env python$(PYTHON_VERSION),g' $(2)/bin/python$(PYTHON_VERSION)-config
(cd $(2)/bin; \
ln -sf python$(PYTHON_VERSION)-config python-config;)
endef
define PyPackage/python3/filespec
define Py3Package/python3/filespec
+|/usr/bin/python$(PYTHON_VERSION)
+|/usr/lib/python$(PYTHON_VERSION)/encodings
+|/usr/lib/python$(PYTHON_VERSION)/_collections_abc.py
@ -155,10 +153,10 @@ define PyPackage/python3/filespec
+|/usr/lib/python$(PYTHON_VERSION)/stat.py
endef
define PyPackage/python3/install
define Py3Package/python3/install
# Adding the lib-dynload folder (even just empty) suppresses 2 warnings when starting Python
$(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/lib-dynload/
ln -sf python$(PYTHON_VERSION) $(1)/usr/bin/python
$(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python3
endef
define Host/Configure
@ -194,6 +192,6 @@ endef
$(eval $(call HostBuild))
$(eval $(call PyPackage,python3))
$(eval $(call Py3Package,python3))
$(eval $(call BuildPackage,python3))

+ 18
- 18
lang/python3/files/python3-package.mk View File

@ -5,34 +5,34 @@
# See /LICENSE for more information.
#
PYTHON_VERSION=3.4
PYTHON_VERSION_MICRO=1
PYTHON3_VERSION:=3.4
PYTHON3_VERSION_MICRO:=1
PYTHON_DIR:=$(STAGING_DIR)/usr
PYTHON_BIN_DIR:=$(PYTHON_DIR)/bin
PYTHON_INC_DIR:=$(PYTHON_DIR)/include/python$(PYTHON_VERSION)
PYTHON_LIB_DIR:=$(PYTHON_DIR)/lib/python$(PYTHON_VERSION)
PYTHON3_DIR:=$(STAGING_DIR)/usr
PYTHON3_BIN_DIR:=$(PYTHON3_DIR)/bin
PYTHON3_INC_DIR:=$(PYTHON3_DIR)/include/python$(PYTHON3_VERSION)
PYTHON3_LIB_DIR:=$(PYTHON3_DIR)/lib/python$(PYTHON3_VERSION)
PYTHON_PKG_DIR:=/usr/lib/python$(PYTHON_VERSION)/site-packages
PYTHON3_PKG_DIR:=/usr/lib/python$(PYTHON3_VERSION)/site-packages
PYTHON:=python$(PYTHON_VERSION)
PYTHON3:=python$(PYTHON3_VERSION)
HOST_PYTHON_BIN:=$(STAGING_DIR)/usr/bin/hostpython
HOST_PYTHON3_BIN:=$(STAGING_DIR_HOST)/bin/python3
define HostPython
( export PYTHONPATH="$(PYTHON_LIB_DIR):$(STAGING_DIR)/$(PYTHON_PKG_DIR)"; \
define HostPython3
( export PYTHONPATH="$(PYTHON3_LIB_DIR):$(STAGING_DIR)/$(PYTHON3_PKG_DIR)"; \
export PYTHONOPTIMIZE=""; \
export PYTHONDONTWRITEBYTECODE=1; \
$(1) \
$(HOST_PYTHON_BIN) $(2); \
$(HOST_PYTHON3_BIN) $(2); \
)
endef
define PyPackage
$(call shexport,PyPackage/$(1)/filespec)
define Py3Package
$(call shexport,Py3Package/$(1)/filespec)
define Package/$(1)/install
@$(SH_FUNC) getvar $$(call shvar,PyPackage/$(1)/filespec) | ( \
@$(SH_FUNC) getvar $$(call shvar,Py3Package/$(1)/filespec) | ( \
IFS='|'; \
while read fop fspec fperm; do \
if [ "$$$$$$$$fop" = "+" ]; then \
@ -57,15 +57,15 @@ define PyPackage
fi; \
done; \
)
$(call PyPackage/$(1)/install,$$(1))
$(call Py3Package/$(1)/install,$$(1))
endef
endef
# $(1) => build subdir
# $(2) => additional arguments to setup.py
# $(3) => additional variables
define Build/Compile/PyMod
$(call HostPython, \
define Build/Compile/Py3Mod
$(call HostPython3, \
cd $(PKG_BUILD_DIR)/$(strip $(1)); \
CFLAGS="$(TARGET_CFLAGS)" \
CPPFLAGS="$(TARGET_CPPFLAGS)" \


Loading…
Cancel
Save