diff --git a/Makefile b/Makefile index 2db779b5..3ad83543 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/cli/Makefile b/cli/Makefile index c9112f3d..fea4906b 100644 --- a/cli/Makefile +++ b/cli/Makefile @@ -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)') diff --git a/cli/koji_cli/Makefile b/cli/koji_cli/Makefile index 42dcdcf9..baf78d37 100644 --- a/cli/koji_cli/Makefile +++ b/cli/koji_cli/Makefile @@ -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)') diff --git a/hub/Makefile b/hub/Makefile index f95a1737..f5fd3d6c 100644 --- a/hub/Makefile +++ b/hub/Makefile @@ -1,4 +1,3 @@ -PYTHON=python PACKAGE = $(shell basename `pwd`) PYFILES = $(wildcard *.py) PYVER := $(shell $(PYTHON) -c 'import sys; print("%.3s" %(sys.version))') diff --git a/koji.spec b/koji.spec index 6f6337be..907b2d89 100644 --- a/koji.spec +++ b/koji.spec @@ -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 diff --git a/koji/Makefile b/koji/Makefile index c1382315..4abb93ba 100644 --- a/koji/Makefile +++ b/koji/Makefile @@ -1,4 +1,3 @@ -PYTHON=python PACKAGE = $(shell basename `pwd`) ifeq ($(PYTHON), python3) # for python3 we fully support only basic library + CLI diff --git a/plugins/Makefile b/plugins/Makefile index cddab666..f775bda4 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -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); \ diff --git a/www/lib/kojiweb/Makefile b/www/lib/kojiweb/Makefile index 85eb5596..84e8b033 100644 --- a/www/lib/kojiweb/Makefile +++ b/www/lib/kojiweb/Makefile @@ -1,4 +1,3 @@ -PYTHON=python PACKAGE = $(shell basename `pwd`) PYFILES = $(wildcard *.py) PYVER := $(shell $(PYTHON) -c 'import sys; print("%.3s" % (sys.version))')