[OE-core] [PATCH 15/15] python-pycairo: fix buildpath QA issue
Hongxu Jia
hongxu.jia at windriver.com
Fri Feb 26 01:45:02 UTC 2016
- Append function unpack_waf to do_unpack to do self-extracting first,
we need to patch on the extracted files.
- Get "--destdir" directory supplied to the "install" command,
and use it as a prefix to strip off the purported filename
encoded in bytecode files.
- Do not need to generate pycairo.pc manually
[YOCTO #8446]
Signed-off-by: Hongxu Jia <hongxu.jia at windriver.com>
---
...trip-off-build-path-in-purported-filename.patch | 62 ++++++++++++++++++++++
.../python/python-pycairo_1.10.0.bb | 22 ++++----
2 files changed, 75 insertions(+), 9 deletions(-)
create mode 100644 meta/recipes-devtools/python/python-pycairo/strip-off-build-path-in-purported-filename.patch
diff --git a/meta/recipes-devtools/python/python-pycairo/strip-off-build-path-in-purported-filename.patch b/meta/recipes-devtools/python/python-pycairo/strip-off-build-path-in-purported-filename.patch
new file mode 100644
index 0000000..647c4be
--- /dev/null
+++ b/meta/recipes-devtools/python/python-pycairo/strip-off-build-path-in-purported-filename.patch
@@ -0,0 +1,62 @@
+From 86faf604fc8a7f17320db48734cda464119da387 Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia at windriver.com>
+Date: Thu, 25 Feb 2016 04:22:07 -0500
+Subject: [PATCH] strip off build path in purported filename
+
+Get the "--destdir" directory supplied to the "install" command,
+and use it as a prefix to strip off the purported filename
+encoded in bytecode files.
+
+Upstream-Status: Inappropriate [openembedded specific]
+
+Signed-off-by: Hongxu Jia <hongxu.jia at windriver.com>
+---
+diff --git a/.waf-1.6.3-3c3129a3ec8fb4a5bbc7ba3161463b22/waflib/Tools/python.py b/.waf-1.6.3-3c3129a3ec8fb4a5bbc7ba3161463b22/waflib/Tools/python.py
+--- a/.waf-1.6.3-3c3129a3ec8fb4a5bbc7ba3161463b22/waflib/Tools/python.py
++++ b/.waf-1.6.3-3c3129a3ec8fb4a5bbc7ba3161463b22/waflib/Tools/python.py
+@@ -26,7 +26,7 @@ int main()
+ INST='''
+ import sys, py_compile
+ for pyfile in sys.argv[1:]:
+- py_compile.compile(pyfile, pyfile + %r)
++ py_compile.compile(pyfile, pyfile + %r, %r)
+ '''
+ def process_py(self,node):
+ try:
+@@ -39,6 +39,16 @@ def process_py(self,node):
+ def inst_py(ctx):
+ install_pyfile(self,node)
+ self.bld.add_post_fun(inst_py)
++
++def get_dfile(dfile):
++ if getattr(Options.options,'destdir'):
++ destdir = Options.options.destdir
++ if dfile[:len(destdir)] != destdir:
++ raise Errors.WafError("invalid destdir: filename %r doesn't start with %r" % ((dfile, destdir)))
++ dfile = dfile[len(destdir):]
++
++ return dfile
++
+ def install_pyfile(self,node):
+ tsk=self.bld.install_files(self.install_path,[node],postpone=False)
+ path=os.path.join(tsk.get_install_path(),node.name)
+@@ -53,12 +63,14 @@ def install_pyfile(self,node):
+ if self.env['PYC']or self.env['PYO']:
+ info("+ byte compiling %r"%path)
+ if self.env['PYC']:
+- argv=self.env['PYTHON']+['-c',INST%'c',path]
++ dfile = get_dfile(path+'c')
++ argv=self.env['PYTHON']+['-c',INST%('c',dfile),path]
+ ret=Utils.subprocess.Popen(argv).wait()
+ if ret:
+ raise Errors.WafError('pyc compilation failed %r'%path)
+ if self.env['PYO']:
+- argv=self.env['PYTHON']+[self.env['PYFLAGS_OPT'],'-c',INST%'o',path]
++ dfile = get_dfile(path+'o')
++ argv=self.env['PYTHON']+[self.env['PYFLAGS_OPT'],'-c',INST%('o',dfile),path]
+ ret=Utils.subprocess.Popen(argv).wait()
+ if ret:
+ raise Errors.WafError('pyo compilation failed %r'%path)
+--
+1.9.1
+
diff --git a/meta/recipes-devtools/python/python-pycairo_1.10.0.bb b/meta/recipes-devtools/python/python-pycairo_1.10.0.bb
index 70fe25c..90a1701 100644
--- a/meta/recipes-devtools/python/python-pycairo_1.10.0.bb
+++ b/meta/recipes-devtools/python/python-pycairo_1.10.0.bb
@@ -11,7 +11,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=f2e071ab72978431b294a0d696327421 \
DEPENDS = "cairo"
PR = "r2"
-SRC_URI = "http://cairographics.org/releases/py2cairo-${PV}.tar.bz2"
+SRC_URI = "http://cairographics.org/releases/py2cairo-${PV}.tar.bz2 \
+ file://strip-off-build-path-in-purported-filename.patch \
+"
SRC_URI[md5sum] = "20337132c4ab06c1146ad384d55372c5"
SRC_URI[sha256sum] = "d30439f06c2ec1a39e27464c6c828b6eface3b22ee17b2de05dc409e429a7431"
@@ -22,8 +24,16 @@ inherit distutils pkgconfig
BBCLASSEXTEND = "native"
+do_unpack[postfuncs] += "unpack_waf"
+do_unpack[vardeps] += "unpack_waf"
+unpack_waf() {
+ # Just self extract tarball embedded in waf, do not care help message.
+ # Do not generate bytecode, becuase we need to patch python file later
+ PYTHONDONTWRITEBYTECODE=True ./waf --help >/dev/null
+}
+
do_configure() {
- BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} ./waf configure --prefix=${D}${prefix} --libdir=${D}${libdir}
+ BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} ./waf configure --prefix=${prefix} --libdir=${libdir}
}
do_compile() {
@@ -31,11 +41,5 @@ do_compile() {
}
do_install() {
- ./waf install
- sed \
- -e 's:@prefix@:${prefix}:' \
- -e 's:@VERSION@:${PV}:' \
- -e 's:@includedir@:${includedir}:' \
- pycairo.pc.in > pycairo.pc
- install -m 0644 pycairo.pc ${D}${libdir}/pkgconfig/
+ ./waf install --destdir=${D}
}
--
1.9.1
More information about the Openembedded-core
mailing list