URL: https://github.com/freeipa/freeipa/pull/1614 Author: tiran Title: #1614: autoconf now prefers Python 3 over 2 Action: opened
PR body: """ The configure script now looks for Python 3.6 or newer, then falls back to Python 2. All Makefile default to Python 3 if Python 3 is available. Move logic for installing just the Python packages out of the spec file and into our root Makefile. It removes code duplication to simplify a spec file that supports building without Python 2 https://pagure.io/freeipa/issue/7131 """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/1614/head:pr1614 git checkout pr1614
From 764615789950c79747bfa57ff0189285c3d14b84 Mon Sep 17 00:00:00 2001 From: Christian Heimes <chei...@redhat.com> Date: Thu, 22 Feb 2018 13:34:18 +0100 Subject: [PATCH 1/2] autoconf prefers Python 3 over 2 The configure script now looks for Python 3.6 or newer, then falls back to Python 2. All Makefile default to Python 3 if Python 3 is available. See: https://pagure.io/freeipa/issue/7131 Signed-off-by: Christian Heimes <chei...@redhat.com> --- configure.ac | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 4b661ecef9..eb8698c96e 100644 --- a/configure.ac +++ b/configure.ac @@ -102,12 +102,15 @@ dnl --------------------------------------------------------------------------- dnl - Check for Python dnl --------------------------------------------------------------------------- -AC_MSG_NOTICE([Checking for Python]) -have_python=no -AM_PATH_PYTHON(2.7) - -if test "x$PYTHON" = "x" ; then - AC_MSG_ERROR([Python not found]) +AC_MSG_NOTICE([Checking for Python 3.6+]) +AM_PATH_PYTHON(3.6,, [:]) + +if test "$PYTHON" = ":" ; then + dnl reset variables and look for Python 2 + unset PYTHON + unset am_cv_pathless_PYTHON + AC_MSG_NOTICE([Checking for Python 2.7]) + AM_PATH_PYTHON(2.7) fi dnl --------------------------------------------------------------------------- From 60be2f605da2b95faac7466b3d3b82ea51338c02 Mon Sep 17 00:00:00 2001 From: Christian Heimes <chei...@redhat.com> Date: Thu, 22 Feb 2018 13:38:41 +0100 Subject: [PATCH 2/2] Simplify Python package installation Move logic for installing just the Python packages out of the spec file and into our root Makefile. It removes code duplication to simplify a spec file that supports building without Python 2. Signed-off-by: Christian Heimes <chei...@redhat.com> --- Makefile.am | 13 ++++++++++--- freeipa.spec.in | 11 +---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Makefile.am b/Makefile.am index 21fb6d19c7..227b9926e5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,8 @@ ACLOCAL_AMFLAGS = -I m4 if ENABLE_SERVER - SERVER_SUBDIRS = daemons init install ipaserver + IPASERVER_SUBDIRS = ipaserver + SERVER_SUBDIRS = daemons init install endif if WITH_IPATESTS @@ -9,9 +10,9 @@ if WITH_IPATESTS endif IPACLIENT_SUBDIRS = ipaclient ipalib ipaplatform ipapython +PYTHON_SUBDIRS = $(IPACLIENT_SUBDIRS) $(IPATESTS_SUBDIRS) $(IPASERVER_SUBDIRS) IPA_PLACEHOLDERS = freeipa ipa ipaserver ipatests -SUBDIRS = asn1 util client contrib po pypi \ - $(IPACLIENT_SUBDIRS) $(IPATESTS_SUBDIRS) $(SERVER_SUBDIRS) +SUBDIRS = asn1 util client contrib po pypi $(PYTHON_SUBDIRS) $(SERVER_SUBDIRS) GENERATED_PYTHON_FILES = \ $(top_builddir)/ipaplatform/override.py \ @@ -358,6 +359,12 @@ pypi_packages: $(WHEELPYPIDIR) .wheelconstraints @echo -e "\n\nTo upload packages to PyPI, run:\n" @echo -e " twine upload $(WHEELPYPIDIR)/*-$(VERSION)-py2.py3-none-any.whl\n" +.PHONY: python_install +python_install: + for dir in $(PYTHON_SUBDIRS); do \ + $(MAKE) $(AM_MAKEFLAGS) -C $${dir} install || exit 1; \ + done + .PHONY: strip-po: $(MAKE) -C po strip-po diff --git a/freeipa.spec.in b/freeipa.spec.in index cf35e67c81..512209e9b9 100644 --- a/freeipa.spec.in +++ b/freeipa.spec.in @@ -989,16 +989,7 @@ make %{?_smp_mflags} check VERBOSE=yes LIBDIR=%{_libdir} # will overwrite /usr/bin/ipa and other scripts with variants using # python2 shebang. pushd %{_builddir}/freeipa-%{version}-python3 -(cd ipaclient && %make_install) -(cd ipalib && %make_install) -(cd ipaplatform && %make_install) -(cd ipapython && %make_install) -%if ! %{ONLY_CLIENT} -(cd ipaserver && %make_install) -%endif # ONLY_CLIENT -%if 0%{?with_ipatests} -(cd ipatests && %make_install) -%endif # with_ipatests +%{__make} python_install DESTDIR=%{?buildroot} INSTALL="%{__install} -p" popd %if 0%{?with_ipatests}
_______________________________________________ FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org