mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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>
This commit is contained in:
committed by
Martin Babinsky
parent
81da45ffb1
commit
8de11b091f
3
.gitignore
vendored
3
.gitignore
vendored
@@ -68,10 +68,7 @@ freeipa2-dev-doc
|
|||||||
/client/ipa-join
|
/client/ipa-join
|
||||||
/client/ipa-rmkeytab
|
/client/ipa-rmkeytab
|
||||||
|
|
||||||
!/ipalib/Makefile
|
|
||||||
|
|
||||||
/ipapython/version.py
|
/ipapython/version.py
|
||||||
!/ipapython/Makefile
|
|
||||||
|
|
||||||
/ipaplatform/__init__.py
|
/ipaplatform/__init__.py
|
||||||
/ipaplatform/constants.py
|
/ipaplatform/constants.py
|
||||||
|
|||||||
@@ -3,3 +3,5 @@ SUBDIRS = asn1 util client daemons install ipaclient ipalib ipaplatform ipapytho
|
|||||||
# contrib
|
# contrib
|
||||||
# doc
|
# doc
|
||||||
# init
|
# init
|
||||||
|
|
||||||
|
MOSTLYCLEANFILES = ipasetup.pyc ipasetup.pyo
|
||||||
|
|||||||
38
Makefile.python.am
Normal file
38
Makefile.python.am
Normal file
@@ -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
|
||||||
@@ -461,8 +461,14 @@ AC_CONFIG_FILES([
|
|||||||
install/restart_scripts/Makefile
|
install/restart_scripts/Makefile
|
||||||
install/wsgi/Makefile
|
install/wsgi/Makefile
|
||||||
install/oddjob/Makefile
|
install/oddjob/Makefile
|
||||||
|
ipaclient/Makefile
|
||||||
|
ipalib/Makefile
|
||||||
|
ipaplatform/Makefile
|
||||||
|
ipapython/Makefile
|
||||||
ipapython/version.py
|
ipapython/version.py
|
||||||
|
ipaserver/Makefile
|
||||||
ipasetup.py
|
ipasetup.py
|
||||||
|
ipatests/Makefile
|
||||||
ipatests/man/Makefile
|
ipatests/man/Makefile
|
||||||
po/Makefile
|
po/Makefile
|
||||||
util/Makefile
|
util/Makefile
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
%if 0%{?rhel}
|
%if 0%{?rhel}
|
||||||
%global with_python3 0
|
%global with_python3 0
|
||||||
%else
|
%else
|
||||||
%global with_python3 1
|
%global with_python3 0
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
# lint is not executed during rpmbuild
|
# lint is not executed during rpmbuild
|
||||||
@@ -699,6 +699,8 @@ make %{?_smp_mflags} client-check VERBOSE=yes LIBDIR=%{_libdir}
|
|||||||
|
|
||||||
%install
|
%install
|
||||||
%make_install
|
%make_install
|
||||||
|
# remove files which are useful only for make uninstall
|
||||||
|
find %{buildroot} -wholename '*/site-packages/*/install_files.txt' -exec rm {} \;
|
||||||
|
|
||||||
mv %{buildroot}%{_bindir}/ipa-run-tests %{buildroot}%{_bindir}/ipa-run-tests-%{python2_version}
|
mv %{buildroot}%{_bindir}/ipa-run-tests %{buildroot}%{_bindir}/ipa-run-tests-%{python2_version}
|
||||||
mv %{buildroot}%{_bindir}/ipa-test-config %{buildroot}%{_bindir}/ipa-test-config-%{python2_version}
|
mv %{buildroot}%{_bindir}/ipa-test-config %{buildroot}%{_bindir}/ipa-test-config-%{python2_version}
|
||||||
|
|||||||
1
ipaclient/Makefile.am
Normal file
1
ipaclient/Makefile.am
Normal file
@@ -0,0 +1 @@
|
|||||||
|
include $(top_srcdir)/Makefile.python.am
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
PYTHON ?= /usr/bin/python2
|
|
||||||
PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib())")
|
|
||||||
|
|
||||||
all:
|
|
||||||
# Pure Python; no need to build
|
|
||||||
true
|
|
||||||
|
|
||||||
check:
|
|
||||||
|
|
||||||
.PHONY: install
|
|
||||||
install:
|
|
||||||
if [ "$(DESTDIR)" = "" ]; then \
|
|
||||||
$(PYTHON) setup.py install; \
|
|
||||||
else \
|
|
||||||
$(PYTHON) setup.py install --root $(DESTDIR); \
|
|
||||||
fi
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf *~ *.pyc __pycache__/
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
|
|
||||||
maintainer-clean: distclean
|
|
||||||
rm -rf build
|
|
||||||
1
ipalib/Makefile.am
Normal file
1
ipalib/Makefile.am
Normal file
@@ -0,0 +1 @@
|
|||||||
|
include $(top_srcdir)/Makefile.python.am
|
||||||
1
ipaplatform/Makefile.am
Normal file
1
ipaplatform/Makefile.am
Normal file
@@ -0,0 +1 @@
|
|||||||
|
include $(top_srcdir)/Makefile.python.am
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
PYTHON ?= /usr/bin/python2
|
|
||||||
PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib())")
|
|
||||||
|
|
||||||
all:
|
|
||||||
@for subdir in $(SUBDIRS); do \
|
|
||||||
(cd $$subdir && $(MAKE) $@) || exit 1; \
|
|
||||||
done
|
|
||||||
|
|
||||||
check:
|
|
||||||
|
|
||||||
.PHONY: install
|
|
||||||
install:
|
|
||||||
if [ "$(DESTDIR)" = "" ]; then \
|
|
||||||
$(PYTHON) setup.py install; \
|
|
||||||
else \
|
|
||||||
$(PYTHON) setup.py install --root $(DESTDIR); \
|
|
||||||
fi
|
|
||||||
@for subdir in $(SUBDIRS); do \
|
|
||||||
(cd $$subdir && $(MAKE) $@) || exit 1; \
|
|
||||||
done
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf *~ *.pyc __pycache__/
|
|
||||||
@for subdir in $(SUBDIRS); do \
|
|
||||||
(cd $$subdir && $(MAKE) $@) || exit 1; \
|
|
||||||
done
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
rm -f ipa-python.spec version.py
|
|
||||||
@for subdir in $(SUBDIRS); do \
|
|
||||||
(cd $$subdir && $(MAKE) $@) || exit 1; \
|
|
||||||
done
|
|
||||||
|
|
||||||
maintainer-clean: distclean
|
|
||||||
rm -rf build
|
|
||||||
@for subdir in $(SUBDIRS); do \
|
|
||||||
(cd $$subdir && $(MAKE) $@) || exit 1; \
|
|
||||||
done
|
|
||||||
1
ipapython/Makefile.am
Normal file
1
ipapython/Makefile.am
Normal file
@@ -0,0 +1 @@
|
|||||||
|
include $(top_srcdir)/Makefile.python.am
|
||||||
1
ipaserver/Makefile.am
Normal file
1
ipaserver/Makefile.am
Normal file
@@ -0,0 +1 @@
|
|||||||
|
include $(top_srcdir)/Makefile.python.am
|
||||||
3
ipatests/Makefile.am
Normal file
3
ipatests/Makefile.am
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
SUBDIRS = man
|
||||||
|
|
||||||
|
include $(top_srcdir)/Makefile.python.am
|
||||||
Reference in New Issue
Block a user