debian-koji/plugins/Makefile
Michal Privoznik 0ef3c75185 Simplify obtaining of PKGDIR
So far, in all Makefiles we have a complicated way to construct
PKGDIR path which is used to install python modules into.
Firstly, python version is obtained, and then system prefix and
these are then used to construct the PKGDIR path. Well, we can do
better. We can use 'site.getsitepackages()[0]' to obtain exactly
the path we are after.

This also fixes the problem on distributions which have split
/usr/lib and /usr/lib64 directories, because with the way we are
constructing the PKGDIR path we assume that the directories are
the same (or one is a symlink to another). Well, that is not
always the case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2020-09-22 13:45:48 +02:00

49 lines
1.8 KiB
Makefile

PKGDIR = $(shell $(PYTHON) -c "import site; print(site.getsitepackages()[0])")/$(PACKAGE)
CLIPLUGINDIR = $(PKGDIR)/koji_cli_plugins
HUBPLUGINDIR = /usr/lib/koji-hub-plugins
BUILDERPLUGINDIR = /usr/lib/koji-builder-plugins
CLIFILES = $(wildcard cli/*.py)
HUBFILES = $(wildcard hub/*.py)
BUILDERFILES = $(wildcard builder/*.py)
CLICONFDIR = /etc/koji/plugins
HUBCONFDIR = /etc/koji-hub/plugins
BUILDERCONFDIR = /etc/kojid/plugins
CLICONFFILES = $(wildcard cli/*.conf)
HUBCONFFILES = $(wildcard hub/*.conf)
BUILDERCONFFILES = $(wildcard builder/*.conf)
_default:
@echo "nothing to make. try make install"
clean:
find . -name "__pycache__" -exec rm -rf {} \; ||:
find . -name "*.pyc" -exec rm -f {} \;
install:
@if [ "$(DESTDIR)" = "" ]; then \
echo " "; \
echo "ERROR: A destdir is required"; \
exit 1; \
fi
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);
mkdir -p $(DESTDIR)/$(BUILDERPLUGINDIR);
install -p -m 644 $(BUILDERFILES) $(DESTDIR)/$(BUILDERPLUGINDIR);
$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(BUILDERPLUGINDIR)', 1, '$(BUILDERPLUGINDIR)', 1)";
mkdir -p $(DESTDIR)/$(BUILDERCONFDIR);
install -p -m 644 $(BUILDERCONFFILES) $(DESTDIR)/$(BUILDERCONFDIR);
endif
mkdir -p $(DESTDIR)/$(CLIPLUGINDIR)
install -p -m 644 $(CLIFILES) $(DESTDIR)/$(CLIPLUGINDIR)
$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(CLIPLUGINDIR)', 1, '$(CLIPLUGINDIR)', 1)"
mkdir -p $(DESTDIR)/$(CLICONFDIR)
ifneq "$(CLICONFFILES)" ""
install -p -m 644 $(CLICONFFILES) $(DESTDIR)/$(CLICONFDIR)
endif