packaging: Block py3 compilation in py2 env

Related: https://pagure.io/koji/issue/3485
This commit is contained in:
Tomas Kopecek 2022-09-06 11:32:32 +02:00
parent 924ad6f563
commit d1a9105179
2 changed files with 10 additions and 5 deletions

View file

@ -1,3 +1,4 @@
PYVER_MAJOR := $(shell $(PYTHON) -c 'import sys; print(".".join(sys.version.split(".")[:1]))')
PACKAGE = $(shell basename `pwd`)
PYFILES = $(wildcard *.py)
PKGDIR = $(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/$(PACKAGE)
@ -30,5 +31,7 @@ install:
for p in $(PYFILES) ; do \
install -p -m 644 $$p $(DESTDIR)/$(SERVERDIR)/$$p; \
done
$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(SERVERDIR)', 1, '$(PYDIR)', 1)"
@if [ "$(PYVER_MAJOR)" == "3" ] ; then \
$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(SERVERDIR)', 1, '$(PYDIR)', 1)" ; \
fi

View file

@ -40,10 +40,12 @@ install:
ifndef KOJI_MINIMAL
mkdir -p $(DESTDIR)/$(HUBPLUGINDIR);
install -p -m 644 $(HUBFILES) $(DESTDIR)/$(HUBPLUGINDIR);
$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(HUBPLUGINDIR)', 1, '$(HUBPLUGINDIR)', 1)";
mkdir -p $(DESTDIR)/$(HUBCONFDIR);
install -p -m 644 $(HUBCONFFILES) $(DESTDIR)/$(HUBCONFDIR);
@if [ "$(PYVER_MAJOR)" == "3" ] ; then \
install -p -m 644 $(HUBFILES) $(DESTDIR)/$(HUBPLUGINDIR); \
$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(HUBPLUGINDIR)', 1, '$(HUBPLUGINDIR)', 1)"; \
mkdir -p $(DESTDIR)/$(HUBCONFDIR); \
install -p -m 644 $(HUBCONFFILES) $(DESTDIR)/$(HUBCONFDIR); \
fi
mkdir -p $(DESTDIR)/$(BUILDERPLUGINDIR);
install -p -m 644 $(BUILDERFILES) $(DESTDIR)/$(BUILDERPLUGINDIR);
$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(BUILDERPLUGINDIR)', 1, '$(BUILDERPLUGINDIR)', 1)";