Skip to content

Add support for python3 - #511

Merged
pombredanne merged 4 commits into
aboutcode-org:developfrom
OmkarPh:py3Support
Jan 24, 2022
Merged

pombredanne merged 4 commits into
aboutcode-org:developfrom
OmkarPh:py3Support

Conversation

@OmkarPh

@OmkarPh OmkarPh commented Jan 12, 2022

Copy link
Copy Markdown
Collaborator

Fixes #502

Signed-off-by: Omkar Phansopkar <omkarphansopkar@gmail.com>
@OmkarPh

OmkarPh commented Jan 12, 2022

Copy link
Copy Markdown
Collaborator Author

I had to modify build.py to fix the err occurring when running python3 build.py. It's fixed for good.
python2 & 3 both work fine with these changes
image

@OmkarPh

OmkarPh commented Jan 12, 2022

Copy link
Copy Markdown
Collaborator Author

@pombredanne ^^

@OmkarPh
OmkarPh force-pushed the py3Support branch 2 times, most recently from f747639 to 35b6540 Compare January 12, 2022 15:10
@OmkarPh

OmkarPh commented Jan 12, 2022

Copy link
Copy Markdown
Collaborator Author

Also, I realised just now that the ^ before versions may install latest versions, hence removed them

Signed-off-by: Omkar Phansopkar <omkarphansopkar@gmail.com>
@pombredanne pombredanne changed the title Adding support for python3 Addisupport for python3 Jan 15, 2022

@pombredanne pombredanne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!
test-wise we likely want to upgrade de linux version and use a not such an advanced Python version... 3.or may be 3.7? being conservative there is best IMHO.

Comment thread .travis.yml Outdated
Comment thread .travis.yml Outdated
@OmkarPh OmkarPh changed the title Addisupport for python3 Add support for python3 Jan 15, 2022
Signed-off-by: Omkar Phansopkar <omkarphansopkar@gmail.com>
@OmkarPh
OmkarPh requested a review from pombredanne January 21, 2022 14:00
Comment thread build.py
@@ -134,17 +134,17 @@ def get_git_version():
# this may fail with exceptions
cmd = 'git', 'describe', '--tags', '--long', '--dirty',
version = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You probably would rather decode early using this: then the b prefix is not needed afterwards

Suggested change
version = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip()
version = subprocess.check_output(cmd, encoding='utf-8', stderr=subprocess.STDOUT).strip()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Hi, I tried that, but it gives error unexpected keyword arg 'encoding' on pyhon2
It works fine with python3 latest versions, but not with python 2.
Also, this guy faced a same issue: eliben/pycparser#296 (comment)

I've done decoding on the next line though, thereby removing need for b prefix

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fair enough... we want to drop Python2 support alright!

@pombredanne pombredanne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I just have a minor nit picking for your review... This is looking good otherwise!
👍

@OmkarPh

OmkarPh commented Jan 24, 2022

Copy link
Copy Markdown
Collaborator Author

did the decode for npm_bin too
This looks much cleaner now ✌️

Signed-off-by: Omkar Phansopkar <omkarphansopkar@gmail.com>

@pombredanne pombredanne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!
Thank you ++

@pombredanne
pombredanne merged commit 4944e41 into aboutcode-org:develop Jan 24, 2022
@pombredanne

Copy link
Copy Markdown
Member

Thanks again!

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.

Support for Python3

2 participants