On 05/06/2016 03:52 PM, Martin Basti wrote:
> 
> 
> On 06.05.2016 15:50, Petr Spacek wrote:
>> On 6.5.2016 15:13, Petr Viktorin wrote:
>>> On 05/03/2016 03:01 PM, Petr Spacek wrote:
>>>> On 29.4.2016 19:49, Petr Viktorin wrote:
>>>>> On 04/12/2016 12:52 PM, Petr Spacek wrote:
>>>>>> On 19.2.2016 13:50, Petr Viktorin wrote:
>>>>>>> Is it time yet?
>>>>>>>
>>>>>>> This patch switches /usr/bin/ipa to Python 3 for
>>>>>>> - the in-tree ./ipa command
>>>>>>> - RPMs, when built with_python3
>>>>>> NACK, the change in 'ipa' command broke ipa dnszone-find:
>>>>>>
>>>>>> # ipa dnsrecord-find dom-033.abc.idm.lab.eng.brq.redhat.com.
>>>>>> ipa: ERROR: b'dom-033.abc.idm.lab.eng.brq.redhat.com.'.: DNS zone
>>>>>> not found
>>>>>>
>>>>>> The same command works when I switch python3->python2 in the 'ipa'
>>>>>> command.
>>>>> That error is now fixed, could you please re-review?
>>>> ACK, I did not find any breakage (when combined with other Py3
>>>> patches).
>>> Hello,
>>> Those patches are now merged. Anything I can do to help push this
>>> forward?
>> Nag the Master Pusher (mbasti) :-)
>>
> I cannot apply patch, sorry :( Please rebase it (both 4.3 and master)

The attached patch should apply on both branches.

-- 
Petr Viktorin
From 062d0f8761ee5e5d1a3a62ccd9936e1e60a794e3 Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pvikt...@redhat.com>
Date: Thu, 18 Feb 2016 16:02:46 +0100
Subject: [PATCH] Switch /usr/bin/ipa to Python 3

When building RPMs with Python 3 support, /usr/bin/ipa will now
use Python 3.
The in-tree ipa command will also run on Python 3.

When building with make install, $(PYTHON) is honored and it will
still default to Python 2.

Part of the work for https://fedorahosted.org/freeipa/ticket/5638
---
 freeipa.spec.in | 11 +++++++++++
 ipa             |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/freeipa.spec.in b/freeipa.spec.in
index 03ebe29b56dff2f874a33f190cce5598a3b2b430..21426d2ef6e6a59e27cc9d46cce07cfd7409bf2b 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -422,7 +422,11 @@ Summary: IPA administrative tools
 Group: System Environment/Base
 BuildArch: noarch
 Requires: %{name}-client-common = %{version}-%{release}
+%if 0%{?with_python3}
+Requires: python3-ipalib = %{version}-%{release}
+%else
 Requires: python2-ipalib = %{version}-%{release}
+%endif
 Requires: python-ldap
 
 Provides: %{alt_name}-admintools = %{version}
@@ -731,6 +735,13 @@ make client-install DESTDIR=%{buildroot}
 (cd ipapython && make PYTHON=%{__python3} IPA_VERSION_IS_GIT_SNAPSHOT=no %{?_smp_mflags} DESTDIR=%{buildroot} install)
 (cd ipaplatform && %{__python3} setup.py install --root %{buildroot})
 (cd ipaclient && %{__python3} setup.py install --root %{buildroot})
+
+# Switch shebang of /usr/bin/ipa
+# XXX: This script is installed with ipaserver. When all of ipaserver is
+# built with Python 3, this will no longer be necessary (as long as the py3
+# version is installed after the py2 version, so it overwrites /usr/bin/ipa)
+sed -i -e'1s/python\(2\|$\)/python3/' %{buildroot}%{_bindir}/ipa
+
 %endif # with_python3
 
 %find_lang %{gettext_domain}
diff --git a/ipa b/ipa
index 9ef356868a444555172d35e5f44a86f6f9914d71..342c5414792cbc2b6a2a393c5a3b8d9a54dbac80 100755
--- a/ipa
+++ b/ipa
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
 
 # Authors:
 #   Jason Gerard DeRose <jder...@redhat.com>
-- 
2.5.5

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to