[PATCH v2 2/2] python-pkg: Fix lirc version detection when cross compiling
Baruch Siach <[email protected]>
| Newsgroups | gmane.comp.hardware.lirc |
|---|---|
| Message-ID | <02d5b038722c77653b646af9b5a2ccd691963af4.1504611572.git.baruch@tkos.co.il> |
The setup.py script that run on the host can't use the client library
built for target. So setup.py falls back to a wrong hard-coded VERSION
value.
Instead of importing the target library, use exec() to read
lirc/config.py directly for its VERSION value.
Fixes build failure:
/usr/bin/install -c -m 644 ./python-pkg/dist/lirc-0.10.0.tar.gz '.../output/host/arm-buildroot-linux-musleabihf/sysroot/usr/share/lirc'
/usr/bin/install: cannot stat './python-pkg/dist/lirc-0.10.0.tar.gz': No such file or directory
---
v2: Don't hard-code VERSION, read config.py directly
---
python-pkg/setup.py | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/python-pkg/setup.py b/python-pkg/setup.py
index e9b33690f828..a2d92e0432aa 100644
--- a/python-pkg/setup.py
+++ b/python-pkg/setup.py
@@ -6,14 +6,11 @@ import subprocess
import os.path
import os
-try:
- import lirc.config
- VERSION = lirc.config.VERSION.replace('-devel','')
-except ImportError:
- VERSION='0.0.0'
-
from setuptools import setup, Extension
+exec(open("lirc/config.py").read())
+VERSION = VERSION.replace('-devel','')
+
if 'CFLAGS' in os.environ:
cflags = os.environ['CFLAGS'].split()
if 'LDFLAGS' in os.environ:
--
2.14.1
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot