Skip to content

Make gyb explicitly reference python2.7 #1535

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

Merged
merged 1 commit into from
Mar 17, 2016
Merged

Make gyb explicitly reference python2.7 #1535

merged 1 commit into from
Mar 17, 2016

Conversation

jasonprado
Copy link

What's in this pull request?

One commit to make gyb reference python2.7 instead of just python.

Resolved bug number: (SR-)


Before merging this pull request to apple/swift repository:

  • Test pull request on Swift continuous integration.

Triggering Swift CI

The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:

Smoke Testing

Platform Comment
All supported platforms @swift-ci Please smoke test
OS X platform @swift-ci Please smoke test OS X platform
Linux platform @swift-ci Please smoke test Linux platform

Validation Testing

Platform Comment
All supported platforms @swift-ci Please test
OS X platform @swift-ci Please test OS X platform
Linux platform @swift-ci Please test Linux platform

Note: Only members of the Apple organization can trigger swift-ci.

The default python on some systems is not 2.7, but gyb needs python2.7
precisely.

The default python on some systems is not 2.7, but gyb needs python2.7
precisely.
@modocache
Copy link
Contributor

We definitely have a few Python scripts that won't work on Python 2.6. What do you think about this, @practicalswift?

@practicalswift
Copy link
Contributor

@jasonmolenda @modocache I think PEP 0394 (The "python" Command on Unix-Like Systems) gives some good guidelines here:

In order to tolerate differences across platforms, all new code that needs to invoke the Python interpreter should not specify python , but rather should specify either python2 or python3 (or the more specific python2.x and python3.x versions; see the Migration Notes ). This distinction should be made in shebangs, when invoking from a shell script, when invoking via the system() call, or when invoking in any other context.

One exception to this is scripts that are deliberately written to be source compatible with both Python 2.x and 3.x. Such scripts may continue to use python on their shebang line without affecting their portability.

Since OS X does not provide any python2-symlink I guess the two available options are: python2.7 (for scripts not compatible with Python 3) and python (for scripts compatible with both Python 2.7 and Python 3).

Questions:

  • Do we have any Python scripts in the repo that are deliberately written to be source compatible with Python 3.x?
  • Regarding Python 2.6 and earlier - can we imagine of a scenario where someone would build Swift on such an old system? I believe building LLVM requires Python 2.7.

If we decide on changing the shebang line for gyb I vote for changing it in all scripts to make the usage consistent.

@modocache
Copy link
Contributor

Do we have any Python scripts in the repo that are deliberately written to be source compatible with Python 3.x?

Work has been done here, yes: #639 and #806. But I think we'll only end up really supporting whatever the CI buildbots use. If we're serious about supporting Python versions besides 2.7, I think we'll need to add to the CI build matrix.

Regarding Python 2.6 and earlier - can we imagine of a scenario where someone would build Swift on such an old system? I believe building LLVM requires Python 2.7.

Not necessarily old: modern releases of CentOS ship with Python 2.6.6. Not sure about the Python version required for LLVM, though.

@RLovelett
Copy link
Contributor

This is something I've been working on/off for awhile (i.e., making all the gyb files Python 2/3 compliant).

There are a few confounding issues regarding PEP 0394 compliance. As far as I can remember (I cannot find the discussion thread anymore to link to it) but OSX is not 0394 compliant (i.e., there is no built in python2.7 or python3 executable; though if you use Homebrew there is). If I even remember correctly a Radar was filed to fix this but until that goes forward the consensus, at that time, was all scripts should be made 2/3 compliant.

Regarding the LLVM requirement. You can read about some of it over here. But my take away is that, yes, LLVM does require Python 2.7 and they are working(?) on supporting both 2 and 3.

@RLovelett
Copy link
Contributor

@jasonprado I compile everyday on a system that has Python 3 and it works. The only thing that doesn't work are the tests. My work around has been to just disable the tests. YMMV but I thought I'd suggest that.

@tkremenek
Copy link
Member

@swift-ci Please test

1 similar comment
@tkremenek
Copy link
Member

@swift-ci Please test

tkremenek added a commit that referenced this pull request Mar 17, 2016
Make gyb explicitly reference python2.7
@tkremenek tkremenek merged commit 78a5edc into swiftlang:master Mar 17, 2016
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.

5 participants