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

Fix python3 sys.platform check for Linux #15727

Merged

Conversation

andrewkroh
Copy link
Member

On Linux, sys.platform doesn’t contain the major version anymore. It is now always ‘linux’, instead of ‘linux2’ or ‘linux3’ depending on the Linux version used to build Python. Replace sys.platform == ‘linux2’ with sys.platform.startswith(‘linux’), or directly sys.platform == ‘linux’ if you don’t need to support older Python versions.

Ref: https://docs.python.org/3.3/whatsnew/3.3.html#porting-python-code

On Linux, sys.platform doesn’t contain the major version anymore. It is now always ‘linux’, instead of ‘linux2’ or ‘linux3’ depending on the Linux version used to build Python. Replace sys.platform == ‘linux2’ with sys.platform.startswith(‘linux’), or directly sys.platform == ‘linux’ if you don’t need to support older Python versions.

Ref: https://docs.python.org/3.3/whatsnew/3.3.html#porting-python-code
@andrewkroh andrewkroh requested a review from a team as a code owner January 22, 2020 02:36
@jsoriano jsoriano mentioned this pull request Jan 22, 2020
63 tasks
Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

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

Good catch.

@andrewkroh andrewkroh merged commit d037668 into elastic:feature/python3 Jan 22, 2020
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
On Linux, sys.platform doesn’t contain the major version anymore. It is now always ‘linux’, instead of ‘linux2’ or ‘linux3’ depending on the Linux version used to build Python. Replace sys.platform == ‘linux2’ with sys.platform.startswith(‘linux’), or directly sys.platform == ‘linux’ if you don’t need to support older Python versions.

Ref: https://docs.python.org/3.3/whatsnew/3.3.html#porting-python-code
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.

2 participants