summaryrefslogtreecommitdiffstats
path: root/Makefile.python.am
diff options
context:
space:
mode:
authorPetr Spacek <pspacek@redhat.com>2016-10-25 14:01:31 +0200
committerMartin Babinsky <mbabinsk@redhat.com>2016-11-09 13:08:32 +0100
commit8de11b091fc705f235b1304fb101c27a82dcda6f (patch)
tree27a1522460fdc611fb850b7cb8f19736a26de5d9 /Makefile.python.am
parent81da45ffb13d126c9b56a2022d88ba8bed2ee18c (diff)
downloadfreeipa-8de11b091fc705f235b1304fb101c27a82dcda6f.tar.gz
freeipa-8de11b091fc705f235b1304fb101c27a82dcda6f.tar.xz
freeipa-8de11b091fc705f235b1304fb101c27a82dcda6f.zip
Build: Makefiles for Python packages
This version builds only one version of Python packages. If you want to build for Python 2 & 3 call configure twice using different --with-python or specify PYTHON variable when calling make. dist-hook is using SOURCES.txt file from egg-info. According to Petr Viktorin this should be enough for our purposes and avoids need to create plugins for setuptools. Currently VPATH builds do not work for various reasons. This should be fixed later on. Most credit goes to these guys: Christian Heimes <cheimes@redhat.com> Petr Viktorin <pviktori@redhat.com> Kevin Brown <kevin@kevin-brown.com> https://fedorahosted.org/freeipa/ticket/6418 Reviewed-By: Martin Basti <mbasti@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com>
Diffstat (limited to 'Makefile.python.am')
-rw-r--r--Makefile.python.am38
1 files changed, 38 insertions, 0 deletions
diff --git a/Makefile.python.am b/Makefile.python.am
new file mode 100644
index 000000000..0ea3fcf16
--- /dev/null
+++ b/Makefile.python.am
@@ -0,0 +1,38 @@
+pkgname = $(shell basename "$(abs_srcdir)")
+pkgpythondir = $(pythondir)/$(pkgname)
+
+all-local:
+ cd $(srcdir); $(PYTHON) setup.py build \
+ --build-base "$(abs_builddir)/build" \
+ --verbose
+
+install-exec-local:
+ $(PYTHON) $(srcdir)/setup.py install \
+ --prefix "$(DESTDIR)$(prefix)" \
+ --single-version-externally-managed \
+ --record "$(DESTDIR)$(pkgpythondir)/install_files.txt" \
+ --optimize 1 \
+ --verbose
+
+uninstall-local:
+ cat "$(DESTDIR)$(pkgpythondir)/install_files.txt" | xargs rm -rf
+ rm -rf "$(DESTDIR)$(pkgpythondir)"
+
+clean-local:
+ $(PYTHON) "$(srcdir)/setup.py" clean --all
+ rm -rf "$(srcdir)/build" "$(srcdir)/dist" "$(srcdir)/MANIFEST"
+ find "$(srcdir)" \
+ -name "*.py[co]" -delete -o \
+ -name "__pycache__" -delete -o \
+ -name "*.egg-info" -exec rm -rf {} +
+
+# take list of all Python source files and copy them into distdir
+# SOURCES.txt does not contain directories so we need to create those
+dist-hook:
+ $(PYTHON) "$(srcdir)/setup.py" egg_info
+ PYTHON_SOURCES=$$(cat "$(srcdir)/$(pkgname).egg-info/SOURCES.txt") || exit $$?; \
+ for FILEN in $${PYTHON_SOURCES}; \
+ do \
+ if test -x "$(srcdir)/$${FILEN}"; then MODE=755; else MODE=644; fi; \
+ $(INSTALL) -D -m $${MODE} "$(srcdir)/$${FILEN}" "$(distdir)/$${FILEN}" || exit $$?; \
+ done