summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTony Theodore <tonyt@logyst.com>2020-12-05 04:52:41 (GMT)
committerTony Theodore <tonyt@logyst.com>2020-12-10 01:38:39 (GMT)
commit22bde36de17ff465aa84dbb623cdd62ae326d062 (patch)
tree61cfafee7a9944624a87f42e272645ded0121533 /src
parent8bf73adae06048fd504fa67bbb6b351bcf0d3356 (diff)
downloadmxe-22bde36de17ff465aa84dbb623cdd62ae326d062.zip
mxe-22bde36de17ff465aa84dbb623cdd62ae326d062.tar.gz
mxe-22bde36de17ff465aa84dbb623cdd62ae326d062.tar.bz2
Makefile & python-conf: improve 2/3 handling with wrapper script
- works with user's default python - can manually override PYTHON variable - installs libraries in mxe-local location (there are too many ways to manage python to document)
Diffstat (limited to 'src')
-rw-r--r--src/python-conf.mk21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/python-conf.mk b/src/python-conf.mk
new file mode 100644
index 0000000..6cd8379
--- /dev/null
+++ b/src/python-conf.mk
@@ -0,0 +1,21 @@
+# This file is part of MXE. See LICENSE.md for licensing information.
+
+PKG := python-conf
+$(PKG)_VERSION := 1
+$(PKG)_UPDATE := echo 1
+$(PKG)_TARGETS := $(BUILD)
+
+PYTHON_SETUP_INSTALL = \
+ cd '$(SOURCE_DIR)' && $(BUILD)-python$(PY_XY_VER) setup.py install \
+ --prefix='$(PREFIX)/$(TARGET)'
+
+define $(PKG)_BUILD_$(BUILD)
+ #create python wrapper in a directory which is in PATH
+ (echo '#!/bin/sh'; \
+ echo 'PYTHONPATH="$(PREFIX)/$(TARGET)/lib/python$(PY_XY_VER)/site-packages" \
+ exec $(PYTHON) "$$@"';) \
+ > '$(PREFIX)/bin/$(TARGET)-python$(PY_XY_VER)'
+ chmod 0755 '$(PREFIX)/bin/$(TARGET)-python$(PY_XY_VER)'
+
+ mkdir -p "$(PREFIX)/$(TARGET)/lib/python$(PY_XY_VER)/site-packages"
+endef