diff options
author | lberki <lberki@google.com> | 2018-02-15 01:18:23 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-02-15 01:20:11 -0800 |
commit | e9c885a88137fa10ea0ac95ff33dcfdc79c6cf0a (patch) | |
tree | ab659dd61c32440be620319bad64f55cec09320d /src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java | |
parent | 0a8dde0a64c3eea0a5b93560cdacc66db4a6885c (diff) |
Automated rollback of commit fa0fac2a4e8a2e5c01b8390878289d00dcc17dba.
*** Reason for rollback ***
Remove example changes; those need to build with the last Bazel release.
*** Original change description ***
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: 185806241
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java | 7 |
1 files changed, 6 insertions, 1 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 e0706923f2..b2ef88db97 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,6 +27,7 @@ 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; @@ -140,7 +141,11 @@ public abstract class PyBinary implements RuleConfiguredTargetFactory { } semantics.collectDefaultRunfiles(ruleContext, builder); builder.add(ruleContext, PythonRunfilesProvider.TO_RUNFILES); - builder.setEmptyFilesSupplier(PythonUtils.GET_INIT_PY_FILES); + + if (!ruleContext.attributes().has("legacy_create_init", Type.BOOLEAN) + || ruleContext.attributes().get("legacy_create_init", Type.BOOLEAN)) { + builder.setEmptyFilesSupplier(PythonUtils.GET_INIT_PY_FILES); + } semantics.collectRunfilesForBinary(ruleContext, builder, common); return builder.build(); } |