Commit 02d6e441 authored by Julien Muchembled's avatar Julien Muchembled

re6st: fix build on OS with Python 3

For CentOS_8 & CentOS_8_Stream, I give up:
- nothing provides python, python2, python3 or /usr/bin/python
  (actually, there's a python2 package on CentOS_8_Stream, but only to ship
  a /usr/bin/python2 that tells the user not to use Python 2... wtf ?)
- by default, there exists /usr/libexec/platform-python and it's functional
  but the build of openssl requires any of python{,2,3} in PATH, which means
  that a probable solution is to:
  - conditionally depend on 'python' only `%if 0%{?centos_ver} != 8`
  - change Makefile.in to add a symlink to /usr/libexec/platform-python
    in a temporary directory that we add to $PATH during the build
- ... but it's probably fine to use packages for CentOS_7
parent eedbe098
......@@ -8,7 +8,7 @@
BUILD = $(TARGET)
PATH := $(CURDIR)/$(BUILD)/parts/chrpath/bin:$(CURDIR)/$(BUILD)/parts/file/bin:$(CURDIR)/$(BUILD)/parts/perl/bin:$(PATH)
PYTHON2 = $(firstword $(wildcard /usr/bin/python2 /usr/bin/python))
PYTHON = $(or $(shell command -v python2 || command -v python || command -v python3),$(error no Python found))
all: $(BUILD)/.installed.cfg
ifneq ($(wildcard upstream.mk),)
......@@ -22,7 +22,7 @@ install: _install
endif
$(BUILD)/bin/buildout:
cd $(BUILD) && $(PYTHON2) -S $(CURDIR)/bootstrap
cd $(BUILD) && $(PYTHON) -S $(CURDIR)/bootstrap
$(BUILD)/.installed.cfg: $(BUILD)/bin/buildout $(BUILD)/buildout.cfg
cd $(BUILD) && bin/buildout babeld-repository:recipe=
......@@ -39,7 +39,7 @@ $(PROGS): $(BUILD)/.installed.cfg
$(DESTDIR)/$(TARGET): $(BUILD)/.installed.cfg
rm -rf $@ && mkdir -p $@/parts
cd $(BUILD) && $(PYTHON2) $(CURDIR)/install-eggs $@ $(BIN)
cd $(BUILD) && $(PYTHON) $(CURDIR)/install-eggs $@ $(BIN)
for x in $(filter-out $(NOPART),$(shell cd $(BUILD)/parts && echo *)); \
do cp --preserve=links -r $(BUILD)/parts/$$x $@/parts; done
cd $@ && $(CURDIR)/cleanup && chmod -R u+w .
......
#!/usr/bin/python2
#!/usr/bin/python
import errno, os, shutil, sys
path = set()
......@@ -15,8 +15,9 @@ sys_path = sys.path
try:
sys.path = SysPath(sys_path)
for x in sys.argv[2:]:
x = os.path.join("bin", x)
try:
execfile(os.path.join("bin", x))
exec(compile(open(x, "rb").read(), x, 'exec'))
except Stop:
pass
finally:
......
......@@ -207,7 +207,7 @@ def deb(task):
d["Version"] = VERSION
d["Architecture"] = b["Architecture"] = "any"
d["Build-Depends"] = s["Build-Depends"] = (
"python (>= 2.7), debhelper (>= 9.20120909),"
"python (>= 2.7) | python2 | python3, debhelper (>= 9.20120909),"
" debhelper (>= 10) | dh-systemd,"
" iproute2 | iproute"
)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment