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

AST parsing in python 2 with encoding and shebang #3750

Merged
merged 4 commits into from Oct 17, 2018

Conversation

Projects
None yet
3 participants
@jgsogo
Copy link
Member

commented Oct 15, 2018

Changelog: Bugfix: AST parsing of conanfile.py with shebang and encoding header lines was failing in python 2. This fix also allows non-ascii chars in conanfile.py if proper encoding is declared.

@ghost ghost assigned jgsogo Oct 15, 2018

@ghost ghost added the stage: review label Oct 15, 2018

@jgsogo jgsogo requested a review from memsharded Oct 15, 2018

@jgsogo jgsogo assigned lasote and memsharded and unassigned lasote Oct 15, 2018

@jgsogo jgsogo added this to the 1.8.3 milestone Oct 15, 2018

# Workaround for https://bugs.python.org/issue22221
lines_without_headers = []
lines = content.splitlines(True)
for line in lines:

This comment has been minimized.

Copy link
@memsharded

memsharded Oct 15, 2018

Contributor

It is not enough to remove the # encoding line?

This comment has been minimized.

Copy link
@jgsogo

jgsogo Oct 16, 2018

Author Member

I put it later in the file to be able to parse/evaluate it... it can have non-ascii chars (and it reminds me that I need to add that in the test file! Thanks!)

This comment has been minimized.

Copy link
@jgsogo

jgsogo Oct 16, 2018

Author Member

it already has non-ascii chars... there are several ¡Ñandú! as authors... 😆

@lasote lasote merged commit 45cff28 into conan-io:release/1.8.3 Oct 17, 2018

2 checks passed

continuous-integration/jenkins/pr-head This commit looks good
Details
license/cla Contributor License Agreement is signed.
Details

@ghost ghost removed the stage: review label Oct 17, 2018

@jgsogo jgsogo deleted the jgsogo:issue/3749 branch Oct 17, 2018

grisumbras pushed a commit to grisumbras/conan that referenced this pull request Dec 27, 2018

AST parsing in python 2 with encoding and shebang (conan-io#3750)
* fix issue conan-io#3749 reported by @hanickadot

* do not split twice if not py2

* if there aren't headers, do not add a blank line

* handle blank lines at the end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.