python2: remove full path from .pyc
authorJérôme Pouiller <jezz@sysmic.org>
Tue, 20 Dec 2016 13:46:26 +0000 (14:46 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sat, 1 Apr 2017 16:30:07 +0000 (18:30 +0200)
.pyc files include path to source .py file. This patch changes the way
`pycompile.py' is launched in order to only keep the part relative to
$TARGET_DIR.

This work was sponsored by `BA Robotic Systems'.

Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/python/python.mk

index e430d741c5e9429c3e8c4938e2a42537f93eec7f..22d9141718405041a0cd36cbcb0739ca358684c9 100644 (file)
@@ -254,9 +254,10 @@ endif
 define PYTHON_CREATE_PYC_FILES
        $(PYTHON_FIX_TIME)
        PYTHONPATH="$(PYTHON_PATH)" \
-       $(HOST_DIR)/usr/bin/python$(PYTHON_VERSION_MAJOR) \
-               support/scripts/pycompile.py $(if $(BR2_REPRODUCIBLE),--force) \
-               $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)
+       cd $(TARGET_DIR) && $(HOST_DIR)/usr/bin/python$(PYTHON_VERSION_MAJOR) \
+               $(TOPDIR)/support/scripts/pycompile.py \
+               $(if $(BR2_REPRODUCIBLE),--force) \
+               usr/lib/python$(PYTHON_VERSION_MAJOR)
 endef
 
 ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY)$(BR2_PACKAGE_PYTHON_PY_PYC),y)