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
Pipeline #21490 failed with stage
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
BUILD = $(TARGET) BUILD = $(TARGET)
PATH := $(CURDIR)/$(BUILD)/parts/chrpath/bin:$(CURDIR)/$(BUILD)/parts/file/bin:$(CURDIR)/$(BUILD)/parts/perl/bin:$(PATH) 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 all: $(BUILD)/.installed.cfg
ifneq ($(wildcard upstream.mk),) ifneq ($(wildcard upstream.mk),)
...@@ -22,7 +22,7 @@ install: _install ...@@ -22,7 +22,7 @@ install: _install
endif endif
$(BUILD)/bin/buildout: $(BUILD)/bin/buildout:
cd $(BUILD) && $(PYTHON2) -S $(CURDIR)/bootstrap cd $(BUILD) && $(PYTHON) -S $(CURDIR)/bootstrap
$(BUILD)/.installed.cfg: $(BUILD)/bin/buildout $(BUILD)/buildout.cfg $(BUILD)/.installed.cfg: $(BUILD)/bin/buildout $(BUILD)/buildout.cfg
cd $(BUILD) && bin/buildout babeld-repository:recipe= cd $(BUILD) && bin/buildout babeld-repository:recipe=
...@@ -39,7 +39,7 @@ $(PROGS): $(BUILD)/.installed.cfg ...@@ -39,7 +39,7 @@ $(PROGS): $(BUILD)/.installed.cfg
$(DESTDIR)/$(TARGET): $(BUILD)/.installed.cfg $(DESTDIR)/$(TARGET): $(BUILD)/.installed.cfg
rm -rf $@ && mkdir -p $@/parts 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 *)); \ for x in $(filter-out $(NOPART),$(shell cd $(BUILD)/parts && echo *)); \
do cp --preserve=links -r $(BUILD)/parts/$$x $@/parts; done do cp --preserve=links -r $(BUILD)/parts/$$x $@/parts; done
cd $@ && $(CURDIR)/cleanup && chmod -R u+w . cd $@ && $(CURDIR)/cleanup && chmod -R u+w .
......
#!/usr/bin/python2 #!/usr/bin/python
import errno, os, shutil, sys import errno, os, shutil, sys
path = set() path = set()
...@@ -15,8 +15,9 @@ sys_path = sys.path ...@@ -15,8 +15,9 @@ sys_path = sys.path
try: try:
sys.path = SysPath(sys_path) sys.path = SysPath(sys_path)
for x in sys.argv[2:]: for x in sys.argv[2:]:
x = os.path.join("bin", x)
try: try:
execfile(os.path.join("bin", x)) exec(compile(open(x, "rb").read(), x, 'exec'))
except Stop: except Stop:
pass pass
finally: finally:
......
...@@ -207,7 +207,7 @@ def deb(task): ...@@ -207,7 +207,7 @@ def deb(task):
d["Version"] = VERSION d["Version"] = VERSION
d["Architecture"] = b["Architecture"] = "any" d["Architecture"] = b["Architecture"] = "any"
d["Build-Depends"] = s["Build-Depends"] = ( d["Build-Depends"] = s["Build-Depends"] = (
"python (>= 2.7), debhelper (>= 9.20120909)," "python (>= 2.7) | python2 | python3, debhelper (>= 9.20120909),"
" debhelper (>= 10) | dh-systemd," " debhelper (>= 10) | dh-systemd,"
" iproute2 | iproute" " iproute2 | iproute"
) )
......
  • Then I removed CentOS_8 & CentOS_8_Stream from home:VIFIBnexedi.

    Another solution could be to find a non-official repository that provides a default python.

    Note that */standard is already a shortcut for selecting all official repositories.

    /cc @tomo @rafael

    Edited by Julien Muchembled
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