diff options
author | 2017-10-19 20:37:40 +0200 | |
---|---|---|
committer | 2017-10-20 14:04:05 +0200 | |
commit | 8b5bf1f440ef8d140eb3843861fbce65709438ea (patch) | |
tree | add463ed197b886232382968101bef0e68cfa9ae /src/main/java/com/google/devtools/build/lib/rules/python/PythonOptions.java | |
parent | 70e0b7a6b567d5f6c189ad044e8965e17b729ad4 (diff) |
Support Python 2 and 3 in the same build.
This is also an example of the versatility of dynamic configurations: this feature
only requires changes to rules/python/...
Issue #3871
PiperOrigin-RevId: 172775001
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/python/PythonOptions.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/python/PythonOptions.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PythonOptions.java b/src/main/java/com/google/devtools/build/lib/rules/python/PythonOptions.java index 34db74f489..81d1c76846 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/python/PythonOptions.java +++ b/src/main/java/com/google/devtools/build/lib/rules/python/PythonOptions.java @@ -24,8 +24,6 @@ import com.google.devtools.common.options.TriState; * Python-related command-line options. */ public class PythonOptions extends FragmentOptions { - static final PythonVersion DEFAULT_PYTHON_VERSION = PythonVersion.PY2; - /** * Converter for the --force_python option. */ @@ -69,7 +67,11 @@ public class PythonOptions extends FragmentOptions { public PythonVersion hostForcePython; public PythonVersion getPythonVersion() { - return (forcePython == null) ? DEFAULT_PYTHON_VERSION : forcePython; + return getPythonVersion(PythonVersion.DEFAULT); + } + + public PythonVersion getPythonVersion(PythonVersion defaultVersion) { + return (forcePython == null) ? defaultVersion : forcePython; } @Override |