aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/python
diff options
context:
space:
mode:
authorGravatar lberki <lberki@google.com>2018-02-14 15:12:23 +0100
committerGravatar Philipp Wollermann <philwo@google.com>2018-02-14 15:54:48 +0100
commitfa0fac2a4e8a2e5c01b8390878289d00dcc17dba (patch)
tree848acb70c03d5cbccd1c30234bef513a4a871f40 /src/main/java/com/google/devtools/build/lib/rules/python
parent0f9c6ea574918dda094cf5423fa3822112846c30 (diff)
Automated rollback of commit 0f9c6ea574918dda094cf5423fa3822112846c30.
*** Reason for rollback *** Breaks Kokoro and I accidentally submitted the change without presubmit checks. *** Original change description *** Make __init__.py files creation optional Introduce a new attribute to py_binary and py_test to control whether to create `__init__.py` or not. Fixes https://github.com/bazelbuild/rules_python/issues/55 Closes #4470. PiperOrigin-RevId: 185676592
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/python')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java7
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/python/PyLibrary.java1
2 files changed, 2 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java b/src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java
index b2ef88db97..e0706923f2 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java
@@ -27,7 +27,6 @@ import com.google.devtools.build.lib.rules.cpp.CcCommon.CcFlagsSupplier;
import com.google.devtools.build.lib.rules.cpp.CcLinkParams;
import com.google.devtools.build.lib.rules.cpp.CcLinkParamsInfo;
import com.google.devtools.build.lib.rules.cpp.CcLinkParamsStore;
-import com.google.devtools.build.lib.syntax.Type;
import com.google.devtools.build.lib.vfs.PathFragment;
import java.util.ArrayList;
import java.util.List;
@@ -141,11 +140,7 @@ public abstract class PyBinary implements RuleConfiguredTargetFactory {
}
semantics.collectDefaultRunfiles(ruleContext, builder);
builder.add(ruleContext, PythonRunfilesProvider.TO_RUNFILES);
-
- if (!ruleContext.attributes().has("legacy_create_init", Type.BOOLEAN)
- || ruleContext.attributes().get("legacy_create_init", Type.BOOLEAN)) {
- builder.setEmptyFilesSupplier(PythonUtils.GET_INIT_PY_FILES);
- }
+ builder.setEmptyFilesSupplier(PythonUtils.GET_INIT_PY_FILES);
semantics.collectRunfilesForBinary(ruleContext, builder, common);
return builder.build();
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PyLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/python/PyLibrary.java
index f41d99baca..adc0ccae37 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/python/PyLibrary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/python/PyLibrary.java
@@ -83,6 +83,7 @@ public abstract class PyLibrary implements RuleConfiguredTargetFactory {
} else {
runfilesBuilder.addTransitiveArtifacts(filesToBuild);
}
+ runfilesBuilder.setEmptyFilesSupplier(PythonUtils.GET_INIT_PY_FILES);
runfilesBuilder.add(ruleContext, PythonRunfilesProvider.TO_RUNFILES);
runfilesBuilder.addRunfiles(ruleContext, RunfilesProvider.DEFAULT_RUNFILES);