1From 732fd31610a6790a927ea9ed6d660796a1641254 Mon Sep 17 00:00:00 2001
2From: Baruch Siach <baruch@tkos.co.il>
3Date: Thu, 7 Sep 2017 08:12:01 +0200
4Subject: [PATCH] build: Fix lirc version detection when cross compiling.
5
6The setup.py script that runs on the host can't use the client library
7built for target. So setup.py falls back to a wrong hard-coded VERSION
8value.
9
10Instead of importing the target library, use exec() to read
11lirc/config.py directly for its VERSION value.
12
13Fixes build failure:
14
15/usr/bin/install -c -m 644 ./python-pkg/dist/lirc-0.10.0.tar.gz \
16    '.../output/host/arm-buildroot-linux-musleabihf/sysroot/usr/share/lirc'
17/usr/bin/install: cannot stat './python-pkg/dist/lirc-0.10.0.tar.gz': \
18    No such file or directory
19
20Signed-off-by: Baruch Siach <baruch@tkos.co.il>
21---
22Upstream status: commit 732fd31610a6
23
24 python-pkg/setup.py | 9 +++------
25 1 file changed, 3 insertions(+), 6 deletions(-)
26
27diff --git a/python-pkg/setup.py b/python-pkg/setup.py
28index e9b33690f828..a2d92e0432aa 100644
29--- a/python-pkg/setup.py
30+++ b/python-pkg/setup.py
31@@ -6,14 +6,11 @@ import subprocess
32 import os.path
33 import os
34
35-try:
36-    import lirc.config
37-    VERSION = lirc.config.VERSION.replace('-devel','')
38-except ImportError:
39-    VERSION='0.0.0'
40-
41 from setuptools import setup, Extension
42
43+exec(open("lirc/config.py").read())
44+VERSION = VERSION.replace('-devel','')
45+
46 if 'CFLAGS' in os.environ:
47     cflags = os.environ['CFLAGS'].split()
48     if 'LDFLAGS' in os.environ:
49--
502.14.1
51
52