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

Port to python3. #117

Merged
merged 13 commits into from Apr 14, 2015
Merged

Port to python3. #117

merged 13 commits into from Apr 14, 2015

Conversation

ralphbean
Copy link
Contributor

This is still a work in progress. The current test suite passes on python3,
but that's not saying much ;p We could use some more test cases.

@@ -47,6 +47,7 @@
import turbogears.util as tg_util
from turbogears.controllers import check_app_root
from turbogears.identity.exceptions import RequestRequiredException
import six
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all for TG1 stuff no? Does import turbogears really work on py3? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely not.

@laxathom
Copy link
Contributor

laxathom commented Apr 8, 2015

👍 on 1rst pass.
We could also clean up some class's as well ;)

@ralphbean
Copy link
Contributor Author

As of now, I have the bodhi and fas clients working on python3. Hand "tested" with this script:

import sys
import fedora.client

import getpass

print(sys.version)
print(fedora.client.__file__)

password = getpass.getpass()
fas = fedora.client.AccountSystem(username='ralph', password=password)
print(fas.people_by_groupname('sysadmin-main'))
print(fas.person_by_username('ralph'))

bodhi = fedora.client.BodhiClient(username='ralph', password=password)
print(bodhi.latest_builds('ansi2html'))
print(bodhi.get_releases())
print(bodhi.query(mine=True))

@ralphbean
Copy link
Contributor Author

Package review for python-munch is here: https://bugzilla.redhat.com/show_bug.cgi?id=1210969

password = getpass.getpass()
#fas = fedora.client.AccountSystem(username='ralph', password=password)
#print(fas.people_by_groupname('sysadmin-main'))
#print(fas.person_by_username('ralph'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment out ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops! I didn't mean to commit that file.

@ralphbean ralphbean changed the title [WIP] Port to python3. Port to python3. Apr 12, 2015
@@ -142,7 +142,7 @@ def query(self, release=None, status=None, type_=None, bugs=None,
auth = False
if params['mine']:
auth = True
for key, value in params.items():
for key, value in list(params.items()):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list() call here isn't really needed, since you just iterate over the items once. You'd need to do something like this in PY3 if you were assigning params.items() to a variable and would want to iterate over it multiple times.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you see the del below? It was raising an error about the dict changing size during iteration (python3 only).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I didn't see that. Everything's ok as it is, then.

@bkabrda
Copy link
Contributor

bkabrda commented Apr 13, 2015

This looks very good. I left one inline comment in the code and have one more general comment: Since you've already decided to depend on six, I'd advise using six.moves [1] to avoid all the try/except ImportError for Python 3 compat. There are several of them in this PR, e.g. in fedora/client/proxyclient.py.

[1] https://pythonhosted.org/six/#module-six.moves

@ralphbean
Copy link
Contributor Author

@bkabrda all cleaned up :)

ralphbean added a commit that referenced this pull request Apr 14, 2015
@ralphbean ralphbean merged commit 5c13818 into develop Apr 14, 2015
@ralphbean ralphbean deleted the feature/six branch April 14, 2015 20:07
@ralphbean
Copy link
Contributor Author

✨ 🔮 ✨ The Future! ✨ 🔮 ✨

@ralphbean ralphbean restored the feature/six branch August 17, 2015 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants