Automated rollback of commit 3fc3ddbc0d2a51853c0966bfd41834765ea619a5.
*** Reason for rollback ***
This CL likely triggers a severe caching bug causing b/115864356. Rolling back to obtain a patch release of Blaze as an alternative to rolling back the Blaze release.
*** Original change description ***
Skip __init__.py in __pycache__ dir.
RELNOTES: None.
PiperOrigin-RevId: 213884642
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PythonUtils.java b/src/main/java/com/google/devtools/build/lib/rules/python/PythonUtils.java
index a53ae8f..c524a30 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/python/PythonUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/python/PythonUtils.java
@@ -36,7 +36,6 @@
public final class PythonUtils {
public static final PathFragment INIT_PY = PathFragment.create("__init__.py");
public static final PathFragment INIT_PYC = PathFragment.create("__init__.pyc");
- public static final PathFragment PYCACHE = PathFragment.create("__pycache__");
private static final FileType REQUIRES_INIT_PY = FileType.of(".py", ".so", ".pyc");
@@ -65,17 +64,14 @@
for (PathFragment source : manifestFiles) {
// If we have a python or .so file at this level...
if (REQUIRES_INIT_PY.matches(source)) {
- // ...then record that we need an __init__.py in this and all parents directories...
+ // ...then record that we need an __init__.py in this directory...
while (source.segmentCount() > 1) {
source = source.getParentDirectory();
- // ...unless it's a Python .pyc cache or we already have __init__ there.
- if (!source.endsWith(PYCACHE)) {
- PathFragment initpy = source.getRelative(INIT_PY);
- PathFragment initpyc = source.getRelative(INIT_PYC);
+ PathFragment initpy = source.getRelative(INIT_PY);
+ PathFragment initpyc = source.getRelative(INIT_PYC);
- if (!manifestFiles.contains(initpy) && !manifestFiles.contains(initpyc)) {
- result.add(initpy);
- }
+ if (!manifestFiles.contains(initpy) && !manifestFiles.contains(initpyc)) {
+ result.add(initpy);
}
}
}