Use /usr/bin/python2

Part of the effort to port FreeIPA to Arch Linux,
where Python 3 is the default.

FreeIPA hasn't been ported to Python 3, so the code must be modified to
run /usr/bin/python2

https://fedorahosted.org/freeipa/ticket/3438

Updated by pviktori@redhat.com
This commit is contained in:
Xiao-Long Chen
2013-11-27 14:53:57 +01:00
committed by Martin Kosek
parent 2a2f5ac4e6
commit 5e96fbc22a
54 changed files with 60 additions and 61 deletions

View File

@@ -50,7 +50,7 @@ ifneq ($(DEVELOPER_MODE),0)
LINT_OPTIONS=--no-fail LINT_OPTIONS=--no-fail
endif endif
PYTHON ?= $(shell rpm -E %__python || echo /usr/bin/python) PYTHON ?= $(shell rpm -E %__python || echo /usr/bin/python2)
CFLAGS := -g -O2 -Werror -Wall -Wextra -Wformat-security -Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers $(CFLAGS) CFLAGS := -g -O2 -Werror -Wall -Wextra -Wformat-security -Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers $(CFLAGS)
export CFLAGS export CFLAGS

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# Authors: # Authors:
# Jason Gerard DeRose <jderose@redhat.com> # Jason Gerard DeRose <jderose@redhat.com>
# John Dennis <jdennis@redhat.com> # John Dennis <jdennis@redhat.com>

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# #
# FreeIPA 2FA companion daemon # FreeIPA 2FA companion daemon
# #

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# Authors: # Authors:
# Jason Gerard DeRose <jderose@redhat.com> # Jason Gerard DeRose <jderose@redhat.com>
# #

View File

@@ -496,7 +496,7 @@ fi
# Restart IPA processes. This must be also run in postrans so that plugins # Restart IPA processes. This must be also run in postrans so that plugins
# and software is in consistent state # and software is in consistent state
python -c "import sys; from ipaserver.install import installutils; sys.exit(0 if installutils.is_ipa_configured() else 1);" > /dev/null 2>&1 python2 -c "import sys; from ipaserver.install import installutils; sys.exit(0 if installutils.is_ipa_configured() else 1);" > /dev/null 2>&1
# NOTE: systemd specific section # NOTE: systemd specific section
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
/bin/systemctl try-restart ipa.service >/dev/null 2>&1 || : /bin/systemctl try-restart ipa.service >/dev/null 2>&1 || :
@@ -532,7 +532,7 @@ fi
winbind_krb5_locator.so /dev/null 90 winbind_krb5_locator.so /dev/null 90
%posttrans server-trust-ad %posttrans server-trust-ad
python -c "import sys; from ipaserver.install import installutils; sys.exit(0 if installutils.is_ipa_configured() else 1);" > /dev/null 2>&1 python2 -c "import sys; from ipaserver.install import installutils; sys.exit(0 if installutils.is_ipa_configured() else 1);" > /dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
# NOTE: systemd specific section # NOTE: systemd specific section
/bin/systemctl try-restart httpd.service >/dev/null 2>&1 || : /bin/systemctl try-restart httpd.service >/dev/null 2>&1 || :

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python -E #!/usr/bin/python2 -E
# #
# Authors: # Authors:
# Rob Crittenden <rcritten@redhat.com> # Rob Crittenden <rcritten@redhat.com>

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python #! /usr/bin/python2
# -*- coding: iso-8859-1 -*- # -*- coding: iso-8859-1 -*-
# Originally written by Barry Warsaw <barry@zope.com> # Originally written by Barry Warsaw <barry@zope.com>
# #

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python -E #!/usr/bin/python2 -E
# #
# Authors: # Authors:
# Rob Crittenden <rcritten@redhat.com> # Rob Crittenden <rcritten@redhat.com>

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python -E #!/usr/bin/python2 -E
# #
# Authors: # Authors:
# Rob Crittenden <rcritten@redhat.com> # Rob Crittenden <rcritten@redhat.com>

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python -E #!/usr/bin/python2 -E
# #
# Authors: # Authors:
# Rob Crittenden <rcritten@redhat.com> # Rob Crittenden <rcritten@redhat.com>

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python -E #!/usr/bin/python2 -E
# #
# Authors: # Authors:
# Rob Crittenden <rcritten@redhat.com> # Rob Crittenden <rcritten@redhat.com>

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python -E #!/usr/bin/python2 -E
# #
# Authors: # Authors:
# Rob Crittenden <rcritten@redhat.com> # Rob Crittenden <rcritten@redhat.com>

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python -E #!/usr/bin/python2 -E
# #
# Authors: # Authors:
# Rob Crittenden <rcritten@redhat.com> # Rob Crittenden <rcritten@redhat.com>

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python #! /usr/bin/python2
"""Copy the IPA schema to the CA directory server instance """Copy the IPA schema to the CA directory server instance

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python #! /usr/bin/python2
# #
# Authors: Sumit Bose <sbose@redhat.com> # Authors: Sumit Bose <sbose@redhat.com>
# Based on ipa-server-install by Karl MacMillan <kmacmillan@mentalrootkit.com> # Based on ipa-server-install by Karl MacMillan <kmacmillan@mentalrootkit.com>

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python -E #! /usr/bin/python2 -E
# Authors: Tomas Babej <tbabej@redhat.com> # Authors: Tomas Babej <tbabej@redhat.com>
# #
# Copyright (C) 2013 Red Hat # Copyright (C) 2013 Red Hat

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python -E #! /usr/bin/python2 -E
# Authors: Rob Crittenden <rcritten@redhat.com> # Authors: Rob Crittenden <rcritten@redhat.com>
# #
# Copyright (C) 2013 Red Hat # Copyright (C) 2013 Red Hat

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python -E #! /usr/bin/python2 -E
# Authors: Rob Crittenden <rcritten@redhat.com> # Authors: Rob Crittenden <rcritten@redhat.com>
# #
# Copyright (C) 2011 Red Hat # Copyright (C) 2011 Red Hat

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# Authors: Rob Crittenden <rcritten@redhat.com> # Authors: Rob Crittenden <rcritten@redhat.com>
# Authors: Simo Sorce <ssorce@redhat.com> # Authors: Simo Sorce <ssorce@redhat.com>
# #

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python -E #! /usr/bin/python2 -E
# Authors: Rob Crittenden <rcritten@redhat.com> # Authors: Rob Crittenden <rcritten@redhat.com>
# #
# Based on ipa-replica-manage by Karl MacMillan <kmacmillan@mentalrootkit.com> # Based on ipa-replica-manage by Karl MacMillan <kmacmillan@mentalrootkit.com>

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python -E #! /usr/bin/python2 -E
# Authors: Martin Nagy <mnagy@redhat.com> # Authors: Martin Nagy <mnagy@redhat.com>
# Based on ipa-server-install by Karl MacMillan <kmacmillan@mentalrootkit.com> # Based on ipa-server-install by Karl MacMillan <kmacmillan@mentalrootkit.com>
# #

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# Authors: Rob Crittenden <rcritten@redhat.com> # Authors: Rob Crittenden <rcritten@redhat.com>
# #
# Copyright (C) 2008 Red Hat # Copyright (C) 2008 Red Hat

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# Authors: Jr Aquino <jr.aquino@citrix.com> # Authors: Jr Aquino <jr.aquino@citrix.com>
# #
# Copyright (C) 2011 Red Hat # Copyright (C) 2011 Red Hat

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# Authors: Rob Crittenden <rcritten@redhat.com> # Authors: Rob Crittenden <rcritten@redhat.com>
# Authors: Simo Sorce <ssorce@redhat.com> # Authors: Simo Sorce <ssorce@redhat.com>
# #

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python -E #! /usr/bin/python2 -E
# Authors: Martin Kosek <mkosek@redhat.com> # Authors: Martin Kosek <mkosek@redhat.com>
# #
# Copyright (C) 2011 Red Hat # Copyright (C) 2011 Red Hat

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python -E #! /usr/bin/python2 -E
# Authors: Karl MacMillan <kmacmillan@mentalrootkit.com> # Authors: Karl MacMillan <kmacmillan@mentalrootkit.com>
# #
# Copyright (C) 2007 Red Hat # Copyright (C) 2007 Red Hat

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python -E #! /usr/bin/python2 -E
# Authors: Karl MacMillan <kmacmillan@mentalrootkit.com> # Authors: Karl MacMillan <kmacmillan@mentalrootkit.com>
# #
# Copyright (C) 2007 Red Hat # Copyright (C) 2007 Red Hat

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python -E #! /usr/bin/python2 -E
# Authors: Petr Viktorin <pviktori@redhat.com> # Authors: Petr Viktorin <pviktori@redhat.com>
# #
# Copyright (C) 2012 Red Hat # Copyright (C) 2012 Red Hat

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python -E #! /usr/bin/python2 -E
# Authors: Rob Crittenden <rcritten@redhat.com> # Authors: Rob Crittenden <rcritten@redhat.com>
# #
# Copyright (C) 2013 Red Hat # Copyright (C) 2013 Red Hat

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python -E #! /usr/bin/python2 -E
# Authors: Jan Cholasta <jcholast@redhat.com> # Authors: Jan Cholasta <jcholast@redhat.com>
# #
# Copyright (C) 2013 Red Hat # Copyright (C) 2013 Red Hat

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python -E #! /usr/bin/python2 -E
# Authors: Karl MacMillan <kmacmillan@mentalrootkit.com> # Authors: Karl MacMillan <kmacmillan@mentalrootkit.com>
# Simo Sorce <ssorce@redhat.com> # Simo Sorce <ssorce@redhat.com>
# Rob Crittenden <rcritten@redhat.com> # Rob Crittenden <rcritten@redhat.com>

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# #
# Authors: # Authors:
# Rob Crittenden <rcritten@redhat.com> # Rob Crittenden <rcritten@redhat.com>

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# Authors: Simo Sorce <ssorce@redhat.com> # Authors: Simo Sorce <ssorce@redhat.com>
# #
# Copyright (C) 2008-2010 Red Hat # Copyright (C) 2008-2010 Red Hat

2
ipa
View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# Authors: # Authors:
# Jason Gerard DeRose <jderose@redhat.com> # Jason Gerard DeRose <jderose@redhat.com>

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python -E #!/usr/bin/python2 -E
# #
# Authors: # Authors:
# Rob Crittenden <rcritten@redhat.com> # Rob Crittenden <rcritten@redhat.com>

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python -E #! /usr/bin/python2 -E
# Authors: Simo Sorce <ssorce@redhat.com> # Authors: Simo Sorce <ssorce@redhat.com>
# Karl MacMillan <kmacmillan@mentalrootkit.com> # Karl MacMillan <kmacmillan@mentalrootkit.com>
# #

View File

@@ -1,4 +1,4 @@
PYTHONLIBDIR ?= $(shell python -c "from distutils.sysconfig import *; print get_python_lib()") PYTHONLIBDIR ?= $(shell python2 -c "from distutils.sysconfig import *; print get_python_lib()")
PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)/ipa PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)/ipa
CONFIGDIR ?= $(DESTDIR)/etc/ipa CONFIGDIR ?= $(DESTDIR)/etc/ipa
TESTS = $(wildcard test/*.py) TESTS = $(wildcard test/*.py)
@@ -12,9 +12,9 @@ all:
install: install:
if [ "$(DESTDIR)" = "" ]; then \ if [ "$(DESTDIR)" = "" ]; then \
python setup.py install; \ python2 setup.py install; \
else \ else \
python setup.py install --root $(DESTDIR); \ python2 setup.py install --root $(DESTDIR); \
fi fi
@for subdir in $(SUBDIRS); do \ @for subdir in $(SUBDIRS); do \
(cd $$subdir && $(MAKE) $@) || exit 1; \ (cd $$subdir && $(MAKE) $@) || exit 1; \
@@ -42,4 +42,4 @@ maintainer-clean: distclean
test: $(subst .py,.tst,$(TESTS)) test: $(subst .py,.tst,$(TESTS))
%.tst: %.py %.tst: %.py
python $< python2 $<

View File

@@ -1,15 +1,15 @@
PYTHONLIBDIR ?= $(shell python -c "from distutils.sysconfig import *; print get_python_lib()") PYTHONLIBDIR ?= $(shell python2 -c "from distutils.sysconfig import *; print get_python_lib()")
PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)/ipa PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)/ipa
CONFIGDIR ?= $(DESTDIR)/etc/ipa CONFIGDIR ?= $(DESTDIR)/etc/ipa
all: all:
python setup.py build python2 setup.py build
install: install:
if [ "$(DESTDIR)" = "" ]; then \ if [ "$(DESTDIR)" = "" ]; then \
python setup.py install; \ python2 setup.py install; \
else \ else \
python setup.py install --root $(DESTDIR); \ python2 setup.py install --root $(DESTDIR); \
fi fi
clean: clean:

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# Copyright (C) 2007 Red Hat # Copyright (C) 2007 Red Hat
# see file 'COPYING' for use and warranty information # see file 'COPYING' for use and warranty information
# #

View File

@@ -1,4 +1,3 @@
#! /usr/bin/python
# Authors: Karl MacMillan <kmacmillan@mentalrootkit.com> # Authors: Karl MacMillan <kmacmillan@mentalrootkit.com>
# Jan Cholasta <jcholast@redhat.com> # Jan Cholasta <jcholast@redhat.com>
# #

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# Authors: # Authors:
# John Dennis <jdennis@redhat.com> # John Dennis <jdennis@redhat.com>
# #

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# Authors: # Authors:
# Petr Viktorin <pviktori@redhat.com> # Petr Viktorin <pviktori@redhat.com>

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python #! /usr/bin/python2
# Authors: # Authors:
# Petr Viktorin <pviktori@redhat.com> # Petr Viktorin <pviktori@redhat.com>

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python #! /usr/bin/python2
# Authors: # Authors:
# Petr Viktorin <pviktori@redhat.com> # Petr Viktorin <pviktori@redhat.com>

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# Copyright (C) 2007 Red Hat # Copyright (C) 2007 Red Hat
# see file 'COPYING' for use and warranty information # see file 'COPYING' for use and warranty information
# #

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
import unittest import unittest
from ipapython.dn import * from ipapython.dn import *

View File

@@ -1,4 +1,4 @@
#! /usr/bin/python -E #! /usr/bin/python2 -E
# #
# Copyright (C) 2007 Red Hat # Copyright (C) 2007 Red Hat
# see file 'COPYING' for use and warranty information # see file 'COPYING' for use and warranty information

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# Authors: # Authors:
# Jason Gerard DeRose <jderose@redhat.com> # Jason Gerard DeRose <jderose@redhat.com>

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# #
# Authors: # Authors:
# Jakub Hrozek <jhrozek@redhat.com> # Jakub Hrozek <jhrozek@redhat.com>

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
""" """
Run IPA unit tests under multiple versions of Python (if present). Run IPA unit tests under multiple versions of Python (if present).

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# #
# Authors: # Authors:
# Rob Crittenden <rcritten@redhat.com> # Rob Crittenden <rcritten@redhat.com>

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# Authors: # Authors:
# Rob Crittenden <rcritten@redhat.com> # Rob Crittenden <rcritten@redhat.com>
# John Dennis <jdennis@redhat.com> # John Dennis <jdennis@redhat.com>

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# Authors: # Authors:
# Jason Gerard DeRose <jderose@redhat.com> # Jason Gerard DeRose <jderose@redhat.com>

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# Authors: # Authors:
# Jason Gerard DeRose <jderose@redhat.com> # Jason Gerard DeRose <jderose@redhat.com>