PR#1019: Use python2/3 instead of python in Makefile/spec

Merges #1019
https://pagure.io/koji/pull-request/1019

Fixes: #1018
https://pagure.io/koji/issue/1018
rpms can't be built in Fedora rawhide
This commit is contained in:
Mike McLean 2019-01-28 06:07:02 -05:00
commit e10daecd2b
8 changed files with 10 additions and 11 deletions

View file

@ -2,6 +2,10 @@ NAME=koji
SPECFILE = $(firstword $(wildcard *.spec))
SUBDIRS = hub builder koji cli util www plugins vm
ifndef PYTHON
export PYTHON=python2
endif
ifdef DIST
DIST_DEFINES := --define "dist $(DIST)"
endif

View file

@ -1,6 +1,5 @@
SUBDIRS=koji_cli
PYTHON=python
PACKAGE = $(shell basename `pwd`)
PYVER := $(shell $(PYTHON) -c 'import sys; print("%.3s" %(sys.version))')
PYSYSDIR := $(shell $(PYTHON) -c 'import sys; print(sys.prefix)')

View file

@ -1,6 +1,5 @@
PYFILES = $(wildcard *.py)
PYTHON=python
PACKAGE = $(shell basename `pwd`)
PYVER := $(shell $(PYTHON) -c 'import sys; print("%.3s" % (sys.version))')
PYSYSDIR := $(shell $(PYTHON) -c 'import sys; print(sys.prefix)')

View file

@ -1,4 +1,3 @@
PYTHON=python
PACKAGE = $(shell basename `pwd`)
PYFILES = $(wildcard *.py)
PYVER := $(shell $(PYTHON) -c 'import sys; print("%.3s" %(sys.version))')

View file

@ -268,14 +268,14 @@ koji-web is a web UI to the Koji system.
%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT %{?install_opt} install
make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python2} %{?install_opt} install
%if 0%{with python3}
cd koji
make DESTDIR=$RPM_BUILD_ROOT PYTHON=python3 %{?install_opt} install
make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} %{?install_opt} install
cd ../cli
make DESTDIR=$RPM_BUILD_ROOT PYTHON=python3 %{?install_opt} install
make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} %{?install_opt} install
cd ../plugins
make DESTDIR=$RPM_BUILD_ROOT PYTHON=python3 %{?install_opt} install
make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} %{?install_opt} install
# alter python interpreter in koji CLI
sed -i 's/\#\!\/usr\/bin\/python2/\#\!\/usr\/bin\/python3/' $RPM_BUILD_ROOT/usr/bin/koji
%endif

View file

@ -1,4 +1,3 @@
PYTHON=python
PACKAGE = $(shell basename `pwd`)
ifeq ($(PYTHON), python3)
# for python3 we fully support only basic library + CLI

View file

@ -1,4 +1,4 @@
PYTHON=python
PYMAJORVER := $(shell $(PYTHON) -c 'import sys; print(sys.version_info[0])')
PYVER := $(shell $(PYTHON) -c 'import sys; print("%.3s" %(sys.version))')
PYSYSDIR := $(shell $(PYTHON) -c 'import sys; print(sys.prefix)')
PYLIBDIR = $(PYSYSDIR)/lib/python$(PYVER)
@ -29,7 +29,7 @@ install:
echo "ERROR: A destdir is required"; \
exit 1; \
fi
if [ "$(PYTHON)" == "python" ] ; then \
if [ "$(PYMAJORVER)" == "2" ] ; then \
mkdir -p $(DESTDIR)/$(HUBPLUGINDIR); \
mkdir -p $(DESTDIR)/$(BUILDERPLUGINDIR); \
install -p -m 644 $(HUBFILES) $(DESTDIR)/$(HUBPLUGINDIR); \

View file

@ -1,4 +1,3 @@
PYTHON=python
PACKAGE = $(shell basename `pwd`)
PYFILES = $(wildcard *.py)
PYVER := $(shell $(PYTHON) -c 'import sys; print("%.3s" % (sys.version))')