Skip to content

Commit 6e0cb65

Browse files
UebelAndremattem
andauthored
Exclude dist-info data from pip_repository targets (bazel-contrib#626)
* Exclude dist-info data from pip_repository targets * recursive exclusion of dist-info Co-authored-by: Matt Mackay <mattem@gmail.com>
1 parent 837050b commit 6e0cb65

File tree

3 files changed

+1
-28
lines changed

3 files changed

+1
-28
lines changed

examples/pip_repository_annotations/WORKSPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ write_file(
3434
copy_executables = {"@pip_repository_annotations_example//:data/copy_executable.py": "copied_content/executable.py"},
3535
copy_files = {"@pip_repository_annotations_example//:data/copy_file.txt": "copied_content/file.txt"},
3636
data = [":generated_file"],
37-
data_exclude_glob = ["*.dist-info/RECORD"],
3837
),
3938
}
4039

examples/pip_repository_annotations/pip_repository_annotations_test.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -64,33 +64,6 @@ def test_copy_executables(self):
6464
stdout = proc.stdout.decode("utf-8").strip()
6565
self.assertEqual(stdout, "Hello world from copied executable")
6666

67-
def test_data_exclude_glob(self):
68-
current_wheel_version = "0.37.1"
69-
70-
r = runfiles.Create()
71-
dist_info_dir = (
72-
"pip_repository_annotations_example/external/{}/wheel-{}.dist-info".format(
73-
self.wheel_pkg_dir(),
74-
current_wheel_version,
75-
)
76-
)
77-
78-
# `WHEEL` is expected to be there to show dist-info files are included in the runfiles
79-
wheel_path = r.Rlocation("{}/WHEEL".format(dist_info_dir))
80-
81-
# However, `RECORD` was explicitly excluded, so it should be missing
82-
record_path = r.Rlocation("{}/RECORD".format(dist_info_dir))
83-
84-
# Because windows does not have `--enable_runfiles` on by default, the
85-
# `runfiles.Rlocation` results will be different on this platform vs
86-
# unix platforms. See `@rules_python//python/runfiles` for more details.
87-
if platform.system() == "Windows":
88-
self.assertIsNotNone(wheel_path)
89-
self.assertIsNone(record_path)
90-
else:
91-
self.assertTrue(Path(wheel_path).exists())
92-
self.assertFalse(Path(record_path).exists())
93-
9467

9568
if __name__ == "__main__":
9669
unittest.main()

python/pip_install/extract_wheels/lib/bazel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ def generate_build_file_contents(
145145
"*.whl",
146146
"**/__pycache__/**",
147147
"**/* *",
148+
"**/*.dist-info/**",
148149
"**/*.py",
149150
"**/*.pyc",
150151
"BUILD.bazel",

0 commit comments

Comments
 (0)