summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2019-09-03 12:19:40 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2019-09-05 08:34:22 (GMT)
commit0a5a222e171958a13d66a28b8c2269c609838d2d (patch)
treec5be715fed577c3943369e570e00db4478a7f2c9
parent18cc55d7735756f03180d95bb8ae87767634cbee (diff)
downloadlasso-0a5a222e171958a13d66a28b8c2269c609838d2d.zip
lasso-0a5a222e171958a13d66a28b8c2269c609838d2d.tar.gz
lasso-0a5a222e171958a13d66a28b8c2269c609838d2d.tar.bz2
Fix python multi-version builds on jessie and stretch
debian/rules supposed that lasso Makefile would always prefer python2 to python3, it's not the case anymore. Also recent python3 improvements to bindings scripts did not work with python 3.5 on jessie (on jessie/3.5 default open() encoding is still ASCII not UTF-8 as with the default UTF-8 of later python3 versions).
-rw-r--r--bindings/bindings.py14
-rw-r--r--debian-jessie/rules34
-rwxr-xr-xdebian-stretch/rules38
3 files changed, 32 insertions, 54 deletions
diff --git a/bindings/bindings.py b/bindings/bindings.py
index b46357d..6a74d28 100644
--- a/bindings/bindings.py
+++ b/bindings/bindings.py
@@ -23,10 +23,16 @@
import os
import re
-from six import print_
+from six import print_, PY3
import sys
from utils import *
+if PY3:
+ do_open = lambda *args, **kwargs: open(*args, encoding='utf-8', **kwargs)
+else:
+ do_open = open
+
+
from optparse import OptionParser
try:
@@ -160,10 +166,10 @@ class BindingData:
if not 'Makefile.am' in filenames:
# not a source dir
continue
- makefile_am = open(os.path.join(base, 'Makefile.am')).read()
+ makefile_am = do_open(os.path.join(base, 'Makefile.am')).read()
filenames = [x for x in filenames if x.endswith('.c') if x in makefile_am]
for filename in filenames:
- s = open(os.path.join(base, filename)).read()
+ s = do_open(os.path.join(base, filename)).read()
docstrings = regex.findall(s)
for d in docstrings:
docstring = '\n'.join([x[3:] for x in d.splitlines()])
@@ -406,7 +412,7 @@ def parse_header(header_file):
in_struct_private = False
in_ifdef_zero = False
- lines = open(header_file).readlines()
+ lines = do_open(header_file).readlines()
i = 0
while i < len(lines):
line = lines[i]
diff --git a/debian-jessie/rules b/debian-jessie/rules
index bbd3411..9e6598a 100644
--- a/debian-jessie/rules
+++ b/debian-jessie/rules
@@ -26,10 +26,8 @@ ifneq ($(DEB_TARGET_ARCH),i386)
endif
endif
-PYDEF := $(shell pyversions -vd)
-PYVERS := $(shell pyversions -vr debian/control)
+PYVERS := $(shell pyversions -vr)
PY3VERS := $(shell py3versions -vr '>= 3.0')
-OTHERPYVERS := $(filter-out $(PYDEF), $(PYVERS))
CFLAGS = `dpkg-buildflags --get CFLAGS`
CFLAGS += -Wall
@@ -66,7 +64,11 @@ config.status: configure
dh_testdir
# Add here commands to configure the package.
autoreconf -fi
- CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) $(CONFIGURE_ARGS)
+ for v in $(PYVERS) $(PY3VERS); do \
+ CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --with-python=/usr/bin/python$$v $(CONFIGURE_ARGS); \
+ rm -rf bindings/python$$v; \
+ cp -a bindings/python bindings/python$$v; \
+ done
build: build-stamp
@@ -76,19 +78,9 @@ build-stamp: config.status
# Add here commands to compile the package.
$(MAKE)
set -e; \
- for v in $(OTHERPYVERS); do \
- rm -rf bindings/python$$v; \
- cp -a bindings/python bindings/python$$v; \
- sed "s/$(PYDEF)/$$v/g" bindings/python/Makefile > bindings/python$$v/Makefile; \
+ for v in $(PYVERS) $(PY3VERS); do \
$(MAKE) -C bindings/python$$v clean; \
- $(MAKE) -C bindings/python$$v; \
- done
- for v in $(PY3VERS); do \
- rm -rf bindings/python$$v; \
- cp -a bindings/python bindings/python$$v; \
- sed "s/$(PYDEF)/$$v/g" bindings/python/Makefile > bindings/python$$v/Makefile; \
- $(MAKE) -C bindings/python$$v clean; \
- $(MAKE) -C bindings/python$$v; \
+ $(MAKE) -C bindings/python$$v V=1; \
done
touch build-stamp
@@ -106,10 +98,7 @@ endif
[ ! -f Makefile ] || $(MAKE) distclean
- for v in $(OTHERPYVERS); do \
- rm -rf bindings/python$$v; \
- done
- for v in $(PY3VERS); do \
+ for v in $(PYVERS) $(PY3VERS); do \
rm -rf bindings/python$$v; \
done
@@ -128,10 +117,7 @@ install: build
$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp \
GACUTIL="/usr/bin/gacutil -root $(CURDIR)/debian/tmp/usr/lib"
set -e; \
- for v in $(OTHERPYVERS); do \
- $(MAKE) -C bindings/python$$v install DESTDIR=$(CURDIR)/debian/tmp; \
- done
- for v in $(PY3VERS); do \
+ for v in $(PYVERS) $(PY3VERS); do \
$(MAKE) -C bindings/python$$v install DESTDIR=$(CURDIR)/debian/tmp; \
done
diff --git a/debian-stretch/rules b/debian-stretch/rules
index 2ada60d..5408bc7 100755
--- a/debian-stretch/rules
+++ b/debian-stretch/rules
@@ -28,10 +28,8 @@ endif
with_php := no
-PYDEF := $(shell pyversions -vd)
-PYVERS := $(shell pyversions -vr debian/control)
+PYVERS := $(shell pyversions -vr)
PY3VERS := $(shell py3versions -vr '>= 3.0')
-OTHERPYVERS := $(filter-out $(PYDEF), $(PYVERS))
CFLAGS = `dpkg-buildflags --get CFLAGS`
CFLAGS += -Wall
@@ -63,9 +61,9 @@ else
endif
ifeq ($(with_php),yes)
- CONFIGURE_ARGS += --enable-php --with-php5-config-dir=/etc/php5/mods-available/
+ CONFIGURE_ARGS += --enable-php5 --with-php5-config-dir=/etc/php5/mods-available/
else
- CONFIGURE_ARGS += --disable-php
+ CONFIGURE_ARGS += --disable-php5
endif
@@ -74,7 +72,11 @@ config.status: configure
dh_testdir
# Add here commands to configure the package.
dh_autoreconf
- CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) $(CONFIGURE_ARGS)
+ for v in $(PYVERS) $(PY3VERS); do \
+ CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --with-python=/usr/bin/python$$v $(CONFIGURE_ARGS); \
+ rm -rf bindings/python$$v; \
+ cp -a bindings/python bindings/python$$v; \
+ done
build: build-stamp
@@ -84,19 +86,9 @@ build-stamp: config.status
# Add here commands to compile the package.
$(MAKE) V=1
set -e; \
- for v in $(OTHERPYVERS); do \
- rm -rf bindings/python$$v; \
- cp -a bindings/python bindings/python$$v; \
- sed "s/$(PYDEF)/$$v/g" bindings/python/Makefile > bindings/python$$v/Makefile; \
+ for v in $(PYVERS) $(PY3VERS); do \
$(MAKE) -C bindings/python$$v clean; \
- $(MAKE) -C bindings/python$$v; \
- done
- for v in $(PY3VERS); do \
- rm -rf bindings/python$$v; \
- cp -a bindings/python bindings/python$$v; \
- sed "s/$(PYDEF)/$$v/g" bindings/python/Makefile > bindings/python$$v/Makefile; \
- $(MAKE) -C bindings/python$$v clean; \
- $(MAKE) -C bindings/python$$v; \
+ $(MAKE) -C bindings/python$$v V=1; \
done
touch build-stamp
@@ -121,10 +113,7 @@ endif
[ ! -f Makefile ] || $(MAKE) distclean
- for v in $(OTHERPYVERS); do \
- rm -rf bindings/python$$v; \
- done
- for v in $(PY3VERS); do \
+ for v in $(PY2VERS) $(PY3VERS); do \
rm -rf bindings/python$$v; \
done
@@ -144,10 +133,7 @@ install: build
$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp \
GACUTIL="/usr/bin/gacutil -root $(CURDIR)/debian/tmp/usr/lib"
set -e; \
- for v in $(OTHERPYVERS); do \
- $(MAKE) -C bindings/python$$v install DESTDIR=$(CURDIR)/debian/tmp; \
- done
- for v in $(PY3VERS); do \
+ for v in $(PYVERS) $(PY3VERS); do \
$(MAKE) -C bindings/python$$v install DESTDIR=$(CURDIR)/debian/tmp; \
done