Exclude dist-info data from pip_repository targets (#626)

* Exclude dist-info data from pip_repository targets

* recursive exclusion of dist-info

Co-authored-by: Matt Mackay <mattem@gmail.com>
diff --git a/examples/pip_repository_annotations/WORKSPACE b/examples/pip_repository_annotations/WORKSPACE
index 95d978b..8234e57 100644
--- a/examples/pip_repository_annotations/WORKSPACE
+++ b/examples/pip_repository_annotations/WORKSPACE
@@ -34,7 +34,6 @@
         copy_executables = {"@pip_repository_annotations_example//:data/copy_executable.py": "copied_content/executable.py"},
         copy_files = {"@pip_repository_annotations_example//:data/copy_file.txt": "copied_content/file.txt"},
         data = [":generated_file"],
-        data_exclude_glob = ["*.dist-info/RECORD"],
     ),
 }
 
diff --git a/examples/pip_repository_annotations/pip_repository_annotations_test.py b/examples/pip_repository_annotations/pip_repository_annotations_test.py
index f904015..0e2e8b3 100644
--- a/examples/pip_repository_annotations/pip_repository_annotations_test.py
+++ b/examples/pip_repository_annotations/pip_repository_annotations_test.py
@@ -64,33 +64,6 @@
         stdout = proc.stdout.decode("utf-8").strip()
         self.assertEqual(stdout, "Hello world from copied executable")
 
-    def test_data_exclude_glob(self):
-        current_wheel_version = "0.37.1"
-
-        r = runfiles.Create()
-        dist_info_dir = (
-            "pip_repository_annotations_example/external/{}/wheel-{}.dist-info".format(
-                self.wheel_pkg_dir(),
-                current_wheel_version,
-            )
-        )
-
-        # `WHEEL` is expected to be there to show dist-info files are included in the runfiles
-        wheel_path = r.Rlocation("{}/WHEEL".format(dist_info_dir))
-
-        # However, `RECORD` was explicitly excluded, so it should be missing
-        record_path = r.Rlocation("{}/RECORD".format(dist_info_dir))
-
-        # Because windows does not have `--enable_runfiles` on by default, the
-        # `runfiles.Rlocation` results will be different on this platform vs
-        # unix platforms. See `@rules_python//python/runfiles` for more details.
-        if platform.system() == "Windows":
-            self.assertIsNotNone(wheel_path)
-            self.assertIsNone(record_path)
-        else:
-            self.assertTrue(Path(wheel_path).exists())
-            self.assertFalse(Path(record_path).exists())
-
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/python/pip_install/extract_wheels/lib/bazel.py b/python/pip_install/extract_wheels/lib/bazel.py
index e967b39..ae10dd9 100644
--- a/python/pip_install/extract_wheels/lib/bazel.py
+++ b/python/pip_install/extract_wheels/lib/bazel.py
@@ -145,6 +145,7 @@
                 "*.whl",
                 "**/__pycache__/**",
                 "**/* *",
+                "**/*.dist-info/**",
                 "**/*.py",
                 "**/*.pyc",
                 "BUILD.bazel",