1dist_noinst_DATA += %D%/libzfs_core %D%/README %D%/LICENSE %D%/docs
2SUBSTFILES += %D%/setup.py
3
4if PYZFS_ENABLED
5ALL_LOCAL += pyzfs-all-local
6pyzfs_V_1 = -v
7pyzfs-all-local: %D%/setup.py
8	cd %D% && $(PYTHON) setup.py -q $(pyzfs_V_$(V)) egg_info -e . build
9
10#
11# On Debian (Ubuntu, and other downstream distros) the install location of
12# Python packages is "../dist-packages" instead of "../site-packages" [1].
13# The install location used by "$(PYTHON) setup.py install" must match the
14# location specified in the ZFS specfile (RPM macro "%{python_sitelib}") to
15# avoid errors during the rpmbuild process.
16# However we cannot pass "--install-layout=deb" to the setup script here because
17# it is not supported on RPM-based distros; we use the combination of
18# "--prefix", "--root" and "--install-lib" parameters instead which should work
19# on every supported system.
20#
21# [1] https://wiki.debian.org/Python#Deviations_from_upstream
22#
23# Using "--no-compile" will not generate .pyc files which, in turn, will not be
24# packaged: this could result in failures during the uninstall phase if these
25# files are later created by manually loading the Python modules.
26#
27install-exec-local:
28	cd %D% && $(PYTHON) setup.py egg_info -e . install \
29	  --prefix $(prefix) \
30	  --root $(DESTDIR)/ \
31	  --install-lib $(pythonsitedir) \
32	  --single-version-externally-managed \
33	  --verbose
34
35CLEAN_LOCAL += pyzfs-clean-local
36pyzfs-clean-local:
37	-$(RM) -r %D%/build/ %D%/pyzfs.egg-info/
38endif
39