-
Notifications
You must be signed in to change notification settings - Fork 138
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
Preliminary python 3.6 port - development #2564 #2567
Preliminary python 3.6 port - development #2564 #2567
Conversation
As part of our move to Python 3 we must first establish our initial python 3 dependencies via Poetry. ## Includes: - Update pyproject.toml and poetry.lock for python 3.6. - Remove int long designator from settings.py: Python 3 no longer uses the "L" suffix. - Use full path in initial import conversions. Python 3 has more stringent import path requirements. - Update imports for 3.6 email module. These differ in Python 3. - Encode unicode line for system.osi.md5sum. TypeError: Unicode-objects must be encoded before hashing - Tidy/update init_sftp_config() re Python 3. There was a subtle file pointer behaviour change between 2.7 and 3.6 which broke this mechanism. - Address TODO re custom opener re Python 3. - Services page & Users page - Python 3 style sorted(): "cmp" sorted parameter and buildin function dropped in Python 3. - init fix of groups page by adaptation to str type. - Replace chardet dependency with charset-normalizer: also used by requests. - Removes redundant encoding on already encoded groupname. - Init dashboard fix via gevent/websocket update. Thanks to @FroggyFlox for investigations here. - Init fix of get_users() - non admin users did not show. Move to more modern - time limited subprocess.run(). - fix samba, disk partition, rockon, re iteritems() In Python 3 we use iter(d.items()) instead: https://peps.python.org/pep-0469/ - Address TODO re ascii to utf-8 on SMART custom options. - Untested bytecast in smart.py: custom options autodev related byte assertion.
N.B. Although these changes enable most functionality within a far newer Python 3.6 local .venv, they break rpmbuild as we require all tests to pass there. However the key purpose of this pull request is to enable spin-off issues to focus developer efforts on ease parallel tasks on fixing the following:
Via clearly defined tasks to restore our testing channel to a build-able and thus release capable status. |
Given this PR gets us to a source build state under python 3.6 (but not rpm buildable due to unit test failure) I propose that we merge it into testing and address the unit test failures as a matter of priority. As many of the tests fail due to Python 3.6 differences re unicode / string / byte i.e. u"some text" etc we likely need a dedicated test issue/s. However we also need to avoid stepping on each others toes. Some tests will of course reflect tested code changes regarding the underlying Python changes we have introduced here. |
Agreed on merging this; that's already in an excellent state, relatively speaking of course. I was going to say "starting point" but that's actually much better than that. |
I know, this is a very minor detail and I don't know where to put this, but since you were moving some of the paths from the |
@Hooverdan96 Re:
If you could create an issue for this I think it would be a viable 'upgrade' as you say simplification is good and that may be the way to go, handing off yet more to systemd. As for this pr I think I'll pop it in as we have much to do by way of follow-up and the sooner it's in the better. N.B. we would normally be reluctant to merge any pr that breaks testing - as it in-turn breaks our rpmbuild (see %checks): But this is literally the first pr in our new testing run and we have changed our base language version (where that is significant in Python 2 to 3) so its merge assists with dividing up the remaining conversion work, some of which likely relates to why all tests are no passing. |
As part of our move to Python 3 we must first establish our
initial python 3 dependencies via Poetry.
Fixes #2564
Includes:
no longer uses the "L" suffix.
has more stringent import path requirements.
TypeError: Unicode-objects must be encoded before hashing
There was a subtle file pointer behaviour change
between 2.7 and 3.6 which broke this mechanism.
"cmp" sorted parameter and buildin function dropped
in Python 3.
also used by requests.
Thanks to @FroggyFlox for investigations here.
Move to more modern - time limited subprocess.run().
In Python 3 we use iter(d.items()) instead:
https://peps.python.org/pep-0469/
custom options autodev related byte assertion.
Independent commits for attribution from @FroggyFlox
Removes now redundant and incompatible mechanism.
Updates this mechanism re Python 3 capabilities.