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
Python 3 Anaconda #122
Commits on Jun 1, 2015
-
Update makebumpver for python3 (#1014220)
Popen returns bytes by default, use a helper method to turn on universal_newlines so that the return values are strings as expected. Update urllib interface for python3 changes. proxy handling is done with a ProxyHandler which needs to be installed before opening the url.
-
Build the Anaconda widgets for Python 3 (#1014220)
Or else there will be issues such as missing overrides.
-
-
-
-
Use the imp module directly (#1014220)
Imputils does not publicly provide the imp module and also does not exist anymore in Python 3. Importing imp directly should work fine in both Python 2 and 3.
-
Change configparser and queue imports (#1014220)
Queue has been renamed to queue and ConfigParser to configparser in Python 3. Also make sure that we don't shadow the queue module by renaming all "queue" variables to "queue_instance".
-
-
Add a test for parse-kickstart (#1014220)
The parse-kickstart script used for anaconda-dracut emits cmdline strings and creates ifcfg files for network settings. Test these to make sure they are working correctly. (cherry picked from commit 9546d9ede8754ab67bdbd3efd7d8c6bc2bf52ec3)
-
Update python-deps for python3 (#1014220)
python-deps should print the unique list of files Add site.py and sysconfig.py dependencies to python-deps Make sure to pick up any dependencies they have by running them through modulefinder. Add PYTHONHASHSEED to python-deps call When creating boot images dracut is run in a minimal chroot with no /dev/urandom, setting PYTHONHASHSEED lets python3 run without it. The seed is used for hashing object ids. It is not used for anything requiring security.
-
-
Update parse-kickstart for python3 (#1014220)
Also Drop the unicode (c) from parse-kickstart It causes modulefinder to choke when reading the file. Arguably a bug with modulefinder, but it solves things for now.
-
Open the VNC password file for binary writing (#1014220)
The vncpasswd utility returns binary output.
-
-
Handle subprocess returning bytes (#1014220)
The subprocess module returns bytes in Python 3, so we need to (try) decoding the output (as utf-8) for functions that expect text string output and there is now a execWithCaptureBinary for forwarding binary output when running commands. We also need to make sure that the output is "printable" when binary output logging to the program.log is enabled.
-
Return a string when calling a program (#1014220)
In the places where Anaconda expects the program to returna string.
-
Fix ASCII conversion tests (#1014220)
The when the correct Unicode normalisation method has been set (NFKD), we need to replace the old bogus values with correct ones in the ASCII conversion tests.
-
Remove "is Unicode" tests (#1014220)
All strings are Unicode strings in Python, so remove tests that check if a string is Unicode or not.
-
Make ASCII conversions Python compatible (#1014220)
Also fix the normalisation method string - it should be "NFKD", not "NKFD".
-
Remove sitecustomize (#1014220)
It was used to force utf-8 as default encoding, which is no longer needed in Python 3.
-
Handle modules requiring different string types in Python 3 (#1014220)
The os.write() function works with bytes, as does the IP address unpacking function. But ProxyString needs a string to prevent various (often cryptic) issues with quote/unquote expecting/returning str/bytes instances.
-
Add and use function that makes sure we work with strings (#1014220)
This is useful in many places where we are never sure if we get str or bytes and we need/want to work with str objects. Also remove one related (previously) unused import and obsolete comment & needless encoding.
-
Handle modules returning bytes in Python 3 (#1014220)
For example rpm and vncconfig.
-
Addapt to string type changes (#1014220)
StringTypes is now str, UnicodeType is also str and StringType is bytes.
-
Don't use exceptions' message attribute (#1014220)
In Python 3 exceptions don't (necessarily) have the 'message' attribute. Just use the str(e) call instead.
-
Don't depend on side effects of map() (#1141242)
In Python 2 calling map() returned a list, which had the side effect of running the given function on all items in the provided iterable, even if the result of the map() call was not used. On the other hand in Python 3 map() returns an iterator and the mapped function is not applied on the iterable until items are yielded from the iterator. In short any map() usage that does not use the iterable **does nothing** in Python 3.
-
Do not run repo attrs' checks if they are not set up yet (#1014220)
During population/refresh of the spoke checks may not be set up yet when widgets change their state.
-
Do not use pykickstart's RepoData as a key in a dict (#1014220)
In Python 3 it is not hashable and it was never meant to be on Python 2 neither.
-
Do not open tty5 for writing in the "a" mode (#1014220)
This results in seek errors in Python 3. Use "wb" instead with the same result in this case.
-
Make gettext usage Python 3 compatible (#1014220)
And persuade it to return strings, not bytes.
-
Replace list comprehension with for at class level
Access to class level variables from list comprehension no longer works in Python 3, so replace it with a for cycle.
-
Rename the warnings spoke to warnings_spoke (#1014220)
It was shadowing the Python standard library warnings module. The py-compile script used by autotools to generate bytecode for Python modules is stupid enough to *prepend* its PWD to PYTHONPATH and because of that it trying to import the warnings spoke in place of the warnings module, breaking the Anaconda package build.
-
-
Python 3 temp files no longer reflect external changes (#1014220)
So if we modify the named tempfile externally, we need to also externally open it to get the externally added content.
-
Set a correct mode for the tempfile (#1014220)
We should open temporary files in text mode if we want to write text strings into them or get text back - tempfiles use the binary mode by default in Python 3.
-
Make isys Python 3 compatible (#1014220)
The Python 3 C extension API has a revamped module initialization code and also some of the autotools Python stuff needed to be changed.
-
Python 3 no longer does tuple parameter unpacking (#1014220)
Both in functions and in lambdas - Python 3 lambda will not unpack the tuple into named arguments. Instead, each argument will need to be referenced by its positional index.
-
-
Make iterators and their usage Python 3 compatible (#1014220)
Various issues such as: - iterators need to be converted to lists before joining to a single list - iterator need to be converted to a list before doing indexed access or using other list specific API on it - trying to add a dict_values to a list - adding lists and dict_values together - use chaining in the above two cases
-
-
-
Don't try to decode strings (#1014220)
Strings are Unicode by default in Python 3 and don't need to be decoded. Also don't do needless encoding and decoding in general.
-
Handle urllib split (#1014220)
Urllib functionality has been split into a number of submodules in Python 3.
-
Avoid comparing None to an integer (#1141242)
None to int comparison became an illegal operation in Python 3.
-
Don't apply numeric comparison on None (#1141242)
While Python 2 tolerates numeric comparisons between None and integers (like for example None > 0), Python 3 no longer tolerates this and considers it to be an error.
-
Make version comparison Python 3 compatible (#1014220)
The __cmp__() function is no longer available in Python 3.
-
Python 3 compatible sorting fixes (#1014220)
Wrap compare functions and make them into key functions or forward port the cmp function.
-
Make sure the column number in TUI is an integer (#1141242)
Division ( / ) returns floating point numbers in Python 3, so use floor division ( // ) to always get an int.
-
Make sure set_system_time() gets an integer (#1014220)
Division always returns a float in Python 3, so it is more likely a float might end in set_system_time(). So wrap the value with int() before calling the function.
-
Only warn about missing yum-utils (#1014220)
Make it possible to run makeupdates without the yum-utils Python module being available. We are now running makeupdates with Python 3 but yum is Python 2 only, so the yum-utils package will never be available.
-
Make sure directory size is returned as int (#1014220)
Division always returns a float in Python 3.
-
Don't use the _safechars private property (#1014220)
Don't use the (deprecated in Python 3) _safechars private property of the pipes module. Generate the set of safe characters locally instead.