Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 Anaconda #122

Closed
wants to merge 54 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
6431e8d
Update makebumpver for python3 (#1014220)
bcl Mar 31, 2015
03be839
Build the Anaconda widgets for Python 3 (#1014220)
M4rtinK Mar 20, 2015
ed9198e
Use Python 3 versions of nose and Pylint (#1014220)
M4rtinK Feb 23, 2015
9c84767
Use /usr/bin/python3 in scripts (#1014220)
M4rtinK Feb 23, 2015
58d2083
Use Python 3 versions of Python dependencies (#1014220)
M4rtinK Feb 18, 2015
a91d39d
Use the imp module directly (#1014220)
M4rtinK Mar 18, 2015
c71381a
Remove imports from the __future__ (#1014220)
M4rtinK Feb 19, 2015
0ae58f4
Change configparser and queue imports (#1014220)
M4rtinK Feb 18, 2015
f2ca5e3
Make the import Python 3 compatible (#1014220)
M4rtinK Mar 5, 2015
badf291
Add a test for parse-kickstart (#1014220)
bcl Mar 30, 2015
a31442f
Update python-deps for python3 (#1014220)
bcl Mar 27, 2015
9dc0ab7
Update driver-updates for python3 (#1014220)
bcl Mar 27, 2015
289d0c0
Update parse-kickstart for python3 (#1014220)
bcl Mar 27, 2015
459b5c2
Open the VNC password file for binary writing (#1014220)
M4rtinK Mar 20, 2015
365920e
Handle latin-1 strings in locale -a output (#1014220)
M4rtinK Mar 6, 2015
f0fdaf0
Handle subprocess returning bytes (#1014220)
M4rtinK Mar 3, 2015
0e2327b
Return a string when calling a program (#1014220)
M4rtinK Feb 26, 2015
cc6ef52
Fix ASCII conversion tests (#1014220)
M4rtinK Feb 25, 2015
776ba23
Remove "is Unicode" tests (#1014220)
M4rtinK Feb 25, 2015
5cb6e4b
Make ASCII conversions Python compatible (#1014220)
M4rtinK Feb 25, 2015
a7bcd5a
Remove sitecustomize (#1014220)
M4rtinK Feb 25, 2015
0582c99
Handle modules requiring different string types in Python 3 (#1014220)
M4rtinK Mar 16, 2015
0f69039
Add and use function that makes sure we work with strings (#1014220)
vpodzime Apr 7, 2015
3660bee
Handle modules returning bytes in Python 3 (#1014220)
M4rtinK Mar 23, 2015
ab15f1c
Addapt to string type changes (#1014220)
M4rtinK Feb 19, 2015
be5651d
Don't use exceptions' message attribute (#1014220)
vpodzime Mar 30, 2015
5dea205
Don't depend on side effects of map() (#1141242)
M4rtinK May 11, 2015
2c494ca
Do not run repo attrs' checks if they are not set up yet (#1014220)
vpodzime Apr 7, 2015
116692d
Do not use pykickstart's RepoData as a key in a dict (#1014220)
vpodzime Apr 7, 2015
08a6606
Do not open tty5 for writing in the "a" mode (#1014220)
vpodzime Mar 25, 2015
3ba2087
Make gettext usage Python 3 compatible (#1014220)
M4rtinK Mar 20, 2015
00cfa83
Replace list comprehension with for at class level
M4rtinK Mar 13, 2015
d3f87a6
Rename the warnings spoke to warnings_spoke (#1014220)
M4rtinK Mar 9, 2015
9e3d77d
Make print usage Python 3 compatible (#1014220)
M4rtinK Mar 6, 2015
fe965c3
Python 3 temp files no longer reflect external changes (#1014220)
M4rtinK Mar 3, 2015
c2dbd12
Set a correct mode for the tempfile (#1014220)
M4rtinK Feb 25, 2015
1b18fda
Make isys Python 3 compatible (#1014220)
M4rtinK Mar 3, 2015
3000c29
Python 3 no longer does tuple parameter unpacking (#1014220)
M4rtinK Feb 20, 2015
db7ceb7
Make the raise syntax Python 3 compatible (#1014220)
M4rtinK Feb 20, 2015
233508f
Convert Python 2 metaclass magic to Python 3 metaclass magic (#1014220)
M4rtinK Feb 20, 2015
470af53
Make iterators and their usage Python 3 compatible (#1014220)
M4rtinK Feb 20, 2015
ee0c839
Replace raw_input() with input() (#1014220)
M4rtinK Feb 20, 2015
8598332
Rename function attributes (#1014220)
M4rtinK Feb 20, 2015
0a691f8
Don't try to decode strings (#1014220)
M4rtinK Mar 18, 2015
93be393
Handle urllib split (#1014220)
M4rtinK Feb 19, 2015
f73bac9
Avoid comparing None to an integer (#1141242)
M4rtinK May 12, 2015
f6ab9f7
Don't apply numeric comparison on None (#1141242)
M4rtinK May 6, 2015
09ce25c
Make version comparison Python 3 compatible (#1014220)
M4rtinK Apr 15, 2015
064e2d8
Python 3 compatible sorting fixes (#1014220)
M4rtinK Mar 23, 2015
2ea40f9
Make sure the column number in TUI is an integer (#1141242)
M4rtinK May 14, 2015
ac8f346
Make sure set_system_time() gets an integer (#1014220)
M4rtinK Mar 23, 2015
1117df6
Only warn about missing yum-utils (#1014220)
M4rtinK Mar 20, 2015
d5d75fe
Make sure directory size is returned as int (#1014220)
M4rtinK Feb 25, 2015
b72c1bf
Don't use the _safechars private property (#1014220)
M4rtinK Feb 25, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions anaconda
@@ -1,4 +1,4 @@
#!/usr/bin/python2
#!/usr/bin/python3
#
# anaconda: The Red Hat Linux Installation program
#
Expand Down Expand Up @@ -120,7 +120,7 @@ def startSpiceVDAgent():

def startX11():
# Open /dev/tty5 for stdout and stderr redirects
xfd = open("/dev/tty5", "a")
xfd = open("/dev/tty5", "wb")

# Start Xorg and wait for it become ready
iutil.startX(["Xorg", "-br", "-logfile", "/tmp/X.log",
Expand Down Expand Up @@ -967,7 +967,8 @@ if __name__ == "__main__":
pidfile = iutil.eintr_retry_call(os.open, pidfile_path, os.O_WRONLY|os.O_CREAT|os.O_EXCL,
stat.S_IRUSR|stat.S_IWUSR|stat.S_IRGRP|stat.S_IWGRP|stat.S_IROTH|stat.S_IWOTH)
pidfile_created = True
iutil.eintr_retry_call(os.write, pidfile, "%s\n" % os.getpid())
pid_string = "%s\n" % os.getpid()
iutil.eintr_retry_call(os.write, pidfile, pid_string.encode("utf-8"))
iutil.eintr_retry_call(os.close, pidfile)
except OSError as e:
# If the failure was anything other than EEXIST during the open call,
Expand Down
60 changes: 28 additions & 32 deletions anaconda.spec.in
Expand Up @@ -27,7 +27,6 @@ Source0: %{name}-%{version}.tar.bz2
%define pypartedver 2.5-2
%define nmver 0.9.9.0-10.git20130906
%define dbusver 1.2.3
%define yumutilsver 1.1.11-3
%define mehver 0.23-1
%define firewalldver 0.3.5-1
%define utillinuxver 2.15.1
Expand All @@ -54,12 +53,12 @@ BuildRequires: intltool >= %{intltoolver}
BuildRequires: libgnomekbd-devel
BuildRequires: libxklavier-devel >= %{libxklavierver}
BuildRequires: pango-devel
BuildRequires: python-kickstart >= %{pykickstartver}
BuildRequires: python3-kickstart >= %{pykickstartver}
%if ! 0%{?rhel}
BuildRequires: python-bugzilla
BuildRequires: python3-bugzilla
%endif
BuildRequires: python-devel
BuildRequires: python-nose
BuildRequires: python3-devel
BuildRequires: python3-nose
BuildRequires: systemd
# rpm and libarchive are needed for driver disk handling
BuildRequires: rpm-devel >= %{rpmver}
Expand All @@ -81,29 +80,28 @@ The anaconda package is a metapackage for the Anaconda installer.

%package core
Summary: Core of the Anaconda installer
Requires: dnf >= %{dnfver}
Requires: python-dnf >= %{dnfver}
Requires: python-blivet >= 1:1.3
Requires: python-meh >= %{mehver}
Requires: python3-dnf >= %{dnfver}
Requires: python3-blivet >= 1:1.0
Requires: python3-meh >= %{mehver}
Requires: libreport-anaconda >= 2.0.21-1
Requires: libselinux-python
Requires: rpm-python >= %{rpmver}
Requires: libselinux-python3
Requires: rpm-python3 >= %{rpmver}
Requires: parted >= %{partedver}
Requires: pyparted >= %{pypartedver}
Requires: python-requests
Requires: python-requests-file
Requires: python-requests-ftp
Requires: python-kickstart >= %{pykickstartver}
Requires: python3-pyparted >= %{pypartedver}
Requires: python3-requests
Requires: python3-requests-file
Requires: python3-requests-ftp
Requires: python3-kickstart >= %{pykickstartver}
Requires: langtable-data >= %{langtablever}
Requires: langtable-python >= %{langtablever}
Requires: libuser-python
Requires: langtable-python3 >= %{langtablever}
Requires: libuser-python3
Requires: authconfig
Requires: firewalld >= %{firewalldver}
Requires: util-linux >= %{utillinuxver}
Requires: dbus-python
Requires: python-pwquality
Requires: python-IPy
Requires: pytz
Requires: python3-dbus
Requires: python3-pwquality
Requires: python-IPy-python3
Requires: python3-pytz
Requires: realmd
Requires: teamd
%ifarch %livearches
Expand All @@ -113,16 +111,15 @@ Requires: usermode
Requires: openssh
%endif
Requires: isomd5sum >= %{isomd5sum}
Requires: yum-utils >= %{yumutilsver}
Requires: createrepo_c
Requires: NetworkManager >= %{nmver}
Requires: NetworkManager-glib >= %{nmver}
Requires: NetworkManager-team
Requires: dhclient
Requires: libselinux-python
Requires: libselinux-python3
Requires: kbd
Requires: chrony
Requires: python-ntplib
Requires: python3-ntplib
Requires: rsync
Requires: systemd
%ifarch %{ix86} x86_64
Expand All @@ -136,11 +133,10 @@ Requires: hfsplus-tools
%endif
Requires: kexec-tools

Requires: python-coverage
Requires: pygobject3-base
Requires: python3-coverage

# Used by rescue.py and the low RAM message in /sbin/anaconda
Requires: newt-python
Requires: newt-python3

# required because of the rescue mode and VNC question
Requires: anaconda-tui = %{version}-%{release}
Expand All @@ -159,7 +155,7 @@ system.
Summary: Graphical user interface for the Anaconda installer
Requires: anaconda-core = %{version}-%{release}
Requires: anaconda-widgets = %{version}-%{release}
Requires: python-meh-gui >= %{mehver}
Requires: python3-meh-gui >= %{mehver}
Requires: adwaita-icon-theme
Requires: system-logos
Requires: tigervnc-server-minimal
Expand All @@ -176,7 +172,7 @@ Requires: NetworkManager-wifi
%endif
Requires: anaconda-user-help >= %{helpver}
Requires: yelp
Requires: pygobject3
Requires: python3-gobject

# Needed to compile the gsettings files
BuildRequires: gsettings-desktop-schemas
Expand All @@ -194,7 +190,7 @@ This package contains textual user interface for the Anaconda installer.
%package widgets
Summary: A set of custom GTK+ widgets for use with anaconda
Group: System Environment/Libraries
Requires: python
Requires: python3

%description widgets
This package contains a set of custom GTK+ widgets used by the anaconda installer.
Expand All @@ -215,7 +211,7 @@ Summary: The anaconda dracut module
Requires: dracut >= %{dracutver}
Requires: dracut-network
Requires: xz
Requires: python-kickstart
Requires: python3-kickstart

%description dracut
The 'anaconda' dracut module handles installer-specific boot tasks and
Expand Down
6 changes: 3 additions & 3 deletions configure.ac
Expand Up @@ -17,7 +17,7 @@
#
# Author: David Cantrell <dcantrell@redhat.com>

m4_define(python_required_version, 2.5)
m4_define(python_required_version, 3.4)

AC_PREREQ([2.63])
AC_INIT([anaconda], [23.8], [anaconda-devel-list@redhat.com])
Expand Down Expand Up @@ -97,9 +97,9 @@ AC_CHECK_LIB([audit], [audit_open], [:],
AM_PATH_PYTHON(python_required_version)

# Check for the python extension paths
PKG_CHECK_MODULES([PYTHON], [python], [
PKG_CHECK_MODULES([PYTHON3], [python3], [
LIBS_save="$LIBS"
LIBS="$LIBS $PYTHON_LIBS"
LIBS="$LIBS $PYTHON3_LIBS"
AC_MSG_CHECKING([Python libraries])
AC_TRY_LINK_FUNC([Py_Initialize],
[AC_MSG_RESULT([yes])],
Expand Down
2 changes: 1 addition & 1 deletion data/command-stubs/list-harddrives-stub
@@ -1,4 +1,4 @@
#!/usr/bin/python2
#!/usr/bin/python3
#
# scan system for harddrives and output device name/size
#
Expand Down
15 changes: 8 additions & 7 deletions dracut/driver-updates
@@ -1,4 +1,4 @@
#!/usr/bin/python2
#!/usr/bin/python3
#
# Copyright (C) 2013 by Red Hat, Inc. All rights reserved.
#
Expand Down Expand Up @@ -66,7 +66,7 @@ def run_cmd(cmd):
try:
with open("/dev/null", "w") as fd_null:
log.debug(" ".join(cmd))
proc = subprocess.Popen(cmd,
proc = subprocess.Popen(cmd, universal_newlines=True,
stdout=subprocess.PIPE,
stderr=fd_null)
out = proc.communicate()[0]
Expand Down Expand Up @@ -114,7 +114,7 @@ def get_dd_args():
return []

# skip dd args that need networking
args.extend(filter(lambda x: x.split(":")[0].lower() not in net_protocols, dd_args))
args.extend(x for x in dd_args if x.split(":")[0].lower() not in net_protocols)
return args


Expand Down Expand Up @@ -497,7 +497,7 @@ def selection_menu(items, title, info_func, multi_choice=True, refresh=False):
opts[0] = "# to toggle selection"
if refresh:
opts.insert(1,"'r'-refresh")
idx = raw_input(''.join(['\n',
idx = input(''.join(['\n',
", ".join(opts[:-1]),
" or ", opts[-1], ": "]))
if idx.isdigit() and not (int(idx) < 1 or int(idx) > num_items):
Expand Down Expand Up @@ -553,14 +553,15 @@ def process_dd(dd_path):
if not any((d.selected for d in drivers)):
return
else:
map(lambda d: setattr(d, "selected", True), drivers)
for driver in drivers:
setattr(driver, "selected", True)

# Copy the repository for Anaconda to use during install
copy_repo(dd_path, "/updates/run/install/DD-")

extracted = []

for driver in filter(lambda d: d.selected, drivers):
for driver in (d for d in drivers if d.selected):
extracted += dd_extract(driver, "/updates/")

# Write the package names for all modules and firmware for Anaconda
Expand Down Expand Up @@ -714,7 +715,7 @@ def select_iso():
return select_iso()
else:
# mount writes out some mounting information, add blank line
print
print()

# let user choose the ISO file
dd_iso = selection_menu(isos, "Choose driver disk ISO file",
Expand Down
2 changes: 1 addition & 1 deletion dracut/module-setup.sh
Expand Up @@ -55,7 +55,7 @@ install() {
# rpm configuration file (needed by dd_extract)
inst "/usr/lib/rpm/rpmrc"
# python deps for parse-kickstart. DOUBLE WOOOO
$moddir/python-deps $moddir/parse-kickstart $moddir/driver-updates | while read dep; do
PYTHONHASHSEED=42 $moddir/python-deps $moddir/parse-kickstart $moddir/driver-updates | while read dep; do
case "$dep" in
*.so) inst_library $dep ;;
*.py) inst_simple $dep ;;
Expand Down
8 changes: 4 additions & 4 deletions dracut/parse-kickstart
@@ -1,12 +1,12 @@
#!/usr/bin/python2
#!/usr/bin/python3
#vim: set fileencoding=utf8
# parse-kickstart - read a kickstart file and emit equivalent dracut boot args
#
# Designed to run inside the dracut initramfs environment.
# Requires python 2.7 or later.
#
#
# Copyright © 2012-2014 Red Hat, Inc.
# Copyright (C) 2012-2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
Expand Down Expand Up @@ -552,7 +552,7 @@ def write_ifcfg(filename, ifcfg):
try:
with open(filename, "w") as f:
f.write('# Generated by parse-kickstart\n')
for k,v in sorted(ifcfg.items()):
for k,v in list(ifcfg.items()):
f.write("%s=%s\n" % (k,v))
except IOError as e:
log.error("can't write %s: %s", filename, e)
Expand Down Expand Up @@ -591,5 +591,5 @@ if __name__ == '__main__':

for path in sys.argv[1:]:
outfile, output = process_kickstart(path)
for line in filter(None, output):
for line in (l for l in output if l):
print(line)
36 changes: 26 additions & 10 deletions dracut/python-deps
@@ -1,16 +1,32 @@
#!/usr/bin/python2
#!/usr/bin/python3
# python-deps - find the dependencies of a given python script.

#
# Copyright (C) 2012-2015 by Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Author(s): Will Woods <wwoods@redhat.com>
#
import copy
import os, sys
from modulefinder import ModuleFinder
# pylint: disable=wildcard-import
from distutils.sysconfig import *
from distutils.sysconfig import get_python_lib, get_config_var, get_makefile_filename, get_config_h_filename

sitedir = get_python_lib()
libdir = get_config_var('LIBDEST')

alsoNeeded = { libdir+"/urllib.py": libdir+"/urllib2.py" }
alsoNeeded = dict()

# A couple helper functions...
def moduledir(pyfile):
Expand All @@ -35,13 +51,15 @@ mods = []
deps = []

scripts = copy.copy(sys.argv[1:])
scripts.append(os.path.join(libdir,'site.py'))
scripts.append(os.path.join(libdir,'sysconfig.py'))

while scripts:
script = scripts.pop()

finder = ModuleFinder()
finder.run_script(script) # parse the script
for mod in finder.modules.itervalues():
for mod in finder.modules.values():
if not mod.__file__: # this module is builtin, so we can skip it
continue

Expand All @@ -59,9 +77,7 @@ while scripts:
# Include some bits that the python install itself needs
print(get_makefile_filename())
print(get_config_h_filename())
print(os.path.join(libdir,'site.py'))
print(os.path.join(libdir,'sysconfig.py'))

# And print the list of deps.
for d in deps:
# And print the list of unique deps.
for d in set(deps):
print(d)
2 changes: 1 addition & 1 deletion po/POTFILES.in
Expand Up @@ -64,7 +64,7 @@ pyanaconda/ui/tui/spokes/shell_spoke.py
pyanaconda/ui/tui/spokes/source.py
pyanaconda/ui/tui/spokes/software.py
pyanaconda/ui/tui/spokes/user.py
pyanaconda/ui/tui/spokes/warnings.py
pyanaconda/ui/tui/spokes/warnings_spoke.py
pyanaconda/ui/tui/spokes/progress.py
pyanaconda/ui/tui/spokes/__init__.py
pyanaconda/ui/tui/__init__.py
Expand Down
6 changes: 3 additions & 3 deletions po/anaconda.pot
Expand Up @@ -2049,12 +2049,12 @@ msgstr ""
msgid "User %s will be created"
msgstr ""

#: pyanaconda/ui/tui/spokes/warnings.py:36
#: pyanaconda/ui/tui/spokes/warnings_spoke.py:36
msgid "Warnings"
msgstr ""

#: pyanaconda/ui/tui/spokes/warnings.py:44
#: pyanaconda/ui/gui/spokes/welcome.glade:517
#: pyanaconda/ui/tui/spokes/warnings_spoke.py:44
#: pyanaconda/ui/gui/spokes/welcome.glade:518
msgid ""
"This hardware (or a combination thereof) is not supported by Red Hat. For "
"more information on supported hardware, please refer to http://www.redhat."
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/addons.py
Expand Up @@ -74,7 +74,7 @@ def __init__(self, dictionary):
self.__dict__ = dictionary

def __str__(self):
return functools.reduce(lambda acc, (id, addon): acc + str(addon),
return functools.reduce(lambda acc, id_addon: acc + str(id_addon[1]),
self.__dict__.items(), "")

def execute(self, storage, ksdata, instClass, users):
Expand Down