URL: https://github.com/freeipa/freeipa/pull/888
Author: MartinBasti
 Title: #888: Make py3 default for ported scripts
Action: opened

PR body:
"""

"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/888/head:pr888
git checkout pr888
From a514972310b480671030df42dd2b4dcecbdac2e1 Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Wed, 21 Jun 2017 17:08:18 +0200
Subject: [PATCH 1/2] py3: temporary set dependencies to both py2 and py3
 packages

We are slowly migrating python scripts to py3 and setting py3 as default
for them. Thus we need to depend on both py2 and py3 packages until
everything is migrated.

https://pagure.io/freeipa/issue/4985
---
 freeipa.spec.in | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/freeipa.spec.in b/freeipa.spec.in
index 9fbe5ad006..8bb8ee57d2 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -277,6 +277,9 @@ Group: System Environment/Base
 Requires: %{name}-server-common = %{version}-%{release}
 Requires: %{name}-client = %{version}-%{release}
 Requires: %{name}-common = %{version}-%{release}
+%if 0%{?with_python3}
+Requires: python3-ipaserver = %{version}-%{release}
+%endif
 Requires: python2-ipaserver = %{version}-%{release}
 Requires: 389-ds-base >= 1.3.5.14
 Requires: openldap-clients > 2.4.35-4
@@ -499,6 +502,9 @@ Summary: IPA authentication for use on clients
 Group: System Environment/Base
 Requires: %{name}-client-common = %{version}-%{release}
 Requires: %{name}-common = %{version}-%{release}
+%if 0%{?with_python3}
+Requires: python3-ipaclient = %{version}-%{release}
+%endif
 Requires: python2-ipaclient = %{version}-%{release}
 Requires: python-ldap
 Requires: cyrus-sasl-gssapi%{?_isa}
@@ -618,6 +624,9 @@ BuildArch: noarch
 Obsoletes: %{name}-python < 4.2.91
 Provides: %{name}-python = %{version}-%{release}
 Requires: %{name}-common = %{version}-%{release}
+%if 0%{?with_python3}
+Requires: python3-ipalib = %{version}-%{release}
+%endif
 Requires: python2-ipalib = %{version}-%{release}
 
 Provides: %{alt_name}-python-compat = %{version}

From 0e27d70cd23a9b8f88eb351d27b006197e93334a Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Wed, 21 Jun 2017 17:59:57 +0200
Subject: [PATCH 2/2] py3: run already ported scripts under py3 by default

To prevent regressions in py3, all ported scripts should be run by py3
by default.

This is temporary and will be removed once porting to py3 is done

https://pagure.io/freeipa/issue/4985
---
 freeipa.spec.in | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/freeipa.spec.in b/freeipa.spec.in
index 8bb8ee57d2..ed9a60a6df 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -864,6 +864,24 @@ find \
 	! -name '*.pyo' -a \
 	-type f -exec grep -qsm1 '^#!.*\bpython' {} \; \
 	-exec sed -i -e '1 s|^#!.*\bpython[^ ]*|#!%{__python2}|' {} \;
+
+%if 0%{?with_python3}
+# TODO: temporary solution until all scripts are ported to python3,
+# TODO: workaround: some scripts are copied over, so the are always py2.
+# We have to explicitly set python3 here for ported files here
+PY3_SUBST_PATHS='
+install/tools/ipa-backup
+install/tools/ipa-compat-manage
+install/tools/ipa-managed-entries
+install/tools/ipa-nis-manage
+install/tools/ipactl
+'
+for P in $PY3_SUBST_PATHS; do
+    sed -i -e '1 s|^#!.*\bpython[^ ]*|#!%{__python3}|' $P
+done;
+
+%endif # with_python3
+
 %configure --with-vendor-suffix=-%{release} \
            %{enable_server_option} \
            %{with_ipatests_option} \
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to