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

jgsogo
Copy link
Contributor

@jgsogo jgsogo 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 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:
Copy link
Member

Choose a reason for hiding this comment

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

It is not enough to remove the # encoding line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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!)

Copy link
Contributor Author

@jgsogo jgsogo Oct 16, 2018

Choose a reason for hiding this comment

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

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
@ghost ghost removed the stage: review label Oct 17, 2018
@jgsogo jgsogo deleted the issue/3749 branch October 17, 2018 13:38
grisumbras pushed a commit to grisumbras/conan that referenced this pull request Dec 27, 2018
* 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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants