diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/python/PythonConfiguration.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/python/PythonConfiguration.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PythonConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/python/PythonConfiguration.java index f950a585f4..74814cce04 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/python/PythonConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/rules/python/PythonConfiguration.java @@ -15,6 +15,8 @@ package com.google.devtools.build.lib.rules.python; import com.google.devtools.build.lib.analysis.config.BuildConfiguration; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; +import com.google.devtools.build.lib.util.OS; +import com.google.devtools.common.options.TriState; /** * The configuration fragment containing information about the various pieces of infrastructure @@ -24,10 +26,13 @@ import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; public class PythonConfiguration extends BuildConfiguration.Fragment { private final boolean ignorePythonVersionAttribute; private final PythonVersion defaultPythonVersion; + private final TriState buildPythonZip; - PythonConfiguration(PythonVersion pythonVersion, boolean ignorePythonVersionAttribute) { + PythonConfiguration( + PythonVersion pythonVersion, boolean ignorePythonVersionAttribute, TriState buildPythonZip) { this.ignorePythonVersionAttribute = ignorePythonVersionAttribute; this.defaultPythonVersion = pythonVersion; + this.buildPythonZip = buildPythonZip; } /** @@ -44,5 +49,17 @@ public class PythonConfiguration extends BuildConfiguration.Fragment { public String getOutputDirectoryName() { return (defaultPythonVersion == PythonVersion.PY3) ? "py3" : null; } + + /** Returns whether to build the executable zip file for Python binaries. */ + public boolean buildPythonZip() { + switch (buildPythonZip) { + case YES: + return true; + case NO: + return false; + default: + return OS.getCurrent() == OS.WINDOWS; + } + } } |