Skip to content
This repository has been archived by the owner on Apr 12, 2021. It is now read-only.

Python 3 #39

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Python 3 #39

wants to merge 14 commits into from

Conversation

rosskarchner
Copy link
Member

@rosskarchner rosskarchner commented Oct 19, 2018

This incorporates work that @sking963 submitted in #35 (thank you! belatedly!), some tox additions I made in #34, and some tweaks to simplify subprocess handling (Python 3.6 was complaining about how the existing code attempted to join bytes and a string).

@@ -16,6 +16,7 @@ See the **Get Involved** section at the end of this readme to see the current st
- Unix-based OS, such as Mac or Linux (Windows support is unclear at this time.)
- [git](http://git-scm.com/)
- [Python 2.7](https://www.python.org/download/releases/2.7/)
or [Python 3.4](https://www.python.org/downloads/release/python-343/)
Copy link
Member

Choose a reason for hiding this comment

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

If tox and Travis are using 3.6, want to bump this?

Copy link
Member Author

Choose a reason for hiding this comment

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

good call

@@ -1,10 +1,13 @@
from abstract import AbstractClient
from __future__ import absolute_import
from .abstract import AbstractClient
Copy link
Member

Choose a reason for hiding this comment

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

Since we're doing this, could we just use the full paths to the imports?

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably? This came from the earlier Python 3 PR, so it's not code I wrote. I'll take a look, though

from abstract import AbstractClient
from __future__ import print_function
from __future__ import absolute_import
from .abstract import AbstractClient
Copy link
Member

Choose a reason for hiding this comment

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

Same with the import path

@@ -1,3 +1,6 @@
from __future__ import print_function
from __future__ import absolute_import
from builtins import object
Copy link
Member

Choose a reason for hiding this comment

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

Does it work that these imports are above the #! and coding lines?

from .parser import Parser
from .commit_parser import CommitParser
from .terms_collector import TermsCollector
from .clouseau_model import ClouseauModel
Copy link
Member

Choose a reason for hiding this comment

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

Same as above re: imports

@@ -1,3 +1,4 @@
from builtins import object
Copy link
Member

Choose a reason for hiding this comment

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

Same as above re: placement above the #!.


import os
import sys
import re
import subprocess
import pprint
from clouseau_model import ClouseauModel
from .clouseau_model import ClouseauModel
Copy link
Member

Choose a reason for hiding this comment

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

Same re: imports

@@ -25,7 +28,7 @@ def parse( self, terms, repo, revlist, clouseau_model, **kwargs ):
for rev in revlist.strip().split(' '):
output = self.get_commit(git_dir, rev)
if output.strip() == '':
print "WARNING: No output was returned from git for commit [%s]. Ensure the commit exists" % rev
print("WARNING: No output was returned from git for commit [%s]. Ensure the commit exists" % rev)
Copy link
Member

Choose a reason for hiding this comment

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

Could we use .format() string formatting? From there it's not a huge jump to f-strings when we go python 3.6+ only 😈 .

@@ -38,7 +41,7 @@ def get_commit(self, git_dir, commit):
git_show = subprocess.Popen(git_show_cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE) # , cwd=git_dir
(out,err) = git_show.communicate()
if err:
print "ERROR running git command [%s]: %s" % (git_show_cmd, err)
print("ERROR running git command [%s]: %s" % (git_show_cmd, err))
Copy link
Member

Choose a reason for hiding this comment

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

Same as above re: string formatting.

except UnicodeDecodeError:
line = unicode( line, 'latin-1' )
line = str( line, 'latin-1' )
Copy link
Member

Choose a reason for hiding this comment

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

More a comment than anything specific to this PR, this seems like an incredibly fragile way to test encoding.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants