diff --git a/.gitignore b/.gitignore index 8ba75d488..98e6ef255 100644 --- a/.gitignore +++ b/.gitignore @@ -68,10 +68,7 @@ freeipa2-dev-doc /client/ipa-join /client/ipa-rmkeytab -!/ipalib/Makefile - /ipapython/version.py -!/ipapython/Makefile /ipaplatform/__init__.py /ipaplatform/constants.py diff --git a/Makefile.am b/Makefile.am index 1e6b47519..6f36c3336 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,3 +3,5 @@ SUBDIRS = asn1 util client daemons install ipaclient ipalib ipaplatform ipapytho # contrib # doc # init + +MOSTLYCLEANFILES = ipasetup.pyc ipasetup.pyo 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 diff --git a/configure.ac b/configure.ac index 6873f5657..b773c0360 100644 --- a/configure.ac +++ b/configure.ac @@ -461,8 +461,14 @@ AC_CONFIG_FILES([ install/restart_scripts/Makefile install/wsgi/Makefile install/oddjob/Makefile + ipaclient/Makefile + ipalib/Makefile + ipaplatform/Makefile + ipapython/Makefile ipapython/version.py + ipaserver/Makefile ipasetup.py + ipatests/Makefile ipatests/man/Makefile po/Makefile util/Makefile diff --git a/freeipa.spec.in b/freeipa.spec.in index 7a093c3e9..15a5d7d53 100644 --- a/freeipa.spec.in +++ b/freeipa.spec.in @@ -5,7 +5,7 @@ %if 0%{?rhel} %global with_python3 0 %else -%global with_python3 1 +%global with_python3 0 %endif # lint is not executed during rpmbuild @@ -699,6 +699,8 @@ make %{?_smp_mflags} client-check VERBOSE=yes LIBDIR=%{_libdir} %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-test-config %{buildroot}%{_bindir}/ipa-test-config-%{python2_version} diff --git a/ipaclient/Makefile.am b/ipaclient/Makefile.am new file mode 100644 index 000000000..8be72b25d --- /dev/null +++ b/ipaclient/Makefile.am @@ -0,0 +1 @@ +include $(top_srcdir)/Makefile.python.am diff --git a/ipalib/Makefile b/ipalib/Makefile deleted file mode 100644 index 9d5c2c1c4..000000000 --- a/ipalib/Makefile +++ /dev/null @@ -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 diff --git a/ipalib/Makefile.am b/ipalib/Makefile.am new file mode 100644 index 000000000..8be72b25d --- /dev/null +++ b/ipalib/Makefile.am @@ -0,0 +1 @@ +include $(top_srcdir)/Makefile.python.am diff --git a/ipaplatform/Makefile.am b/ipaplatform/Makefile.am new file mode 100644 index 000000000..8be72b25d --- /dev/null +++ b/ipaplatform/Makefile.am @@ -0,0 +1 @@ +include $(top_srcdir)/Makefile.python.am diff --git a/ipapython/Makefile b/ipapython/Makefile deleted file mode 100644 index 7ecc5f565..000000000 --- a/ipapython/Makefile +++ /dev/null @@ -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 diff --git a/ipapython/Makefile.am b/ipapython/Makefile.am new file mode 100644 index 000000000..8be72b25d --- /dev/null +++ b/ipapython/Makefile.am @@ -0,0 +1 @@ +include $(top_srcdir)/Makefile.python.am diff --git a/ipaserver/Makefile.am b/ipaserver/Makefile.am new file mode 100644 index 000000000..8be72b25d --- /dev/null +++ b/ipaserver/Makefile.am @@ -0,0 +1 @@ +include $(top_srcdir)/Makefile.python.am diff --git a/ipatests/Makefile.am b/ipatests/Makefile.am new file mode 100644 index 000000000..4f3bca221 --- /dev/null +++ b/ipatests/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS = man + +include $(top_srcdir)/Makefile.python.am