Use BUILD.bazel file when creating py_library rules of extracted whls (#427)
diff --git a/python/pip_install/extract_wheels/lib/bazel.py b/python/pip_install/extract_wheels/lib/bazel.py index ef0d6e8..0affa20 100644 --- a/python/pip_install/extract_wheels/lib/bazel.py +++ b/python/pip_install/extract_wheels/lib/bazel.py
@@ -27,7 +27,7 @@ there may be no Python sources whatsoever (e.g. packages written in Cython: like `pymssql`). """ - data_exclude = ["*.whl", "**/*.py", "**/* *", "BUILD", "WORKSPACE"] + pip_data_exclude + data_exclude = ["*.whl", "**/*.py", "**/* *", "BUILD.bazel", "WORKSPACE"] + pip_data_exclude return textwrap.dedent( """\ @@ -184,7 +184,7 @@ '"//%s:%s"' % (sanitise_name(d), WHEEL_FILE_LABEL) for d in whl_deps ] - with open(os.path.join(directory, "BUILD"), "w") as build_file: + with open(os.path.join(directory, "BUILD.bazel"), "w") as build_file: contents = generate_build_file_contents( sanitise_name(whl.name), sanitised_dependencies, sanitised_wheel_file_dependencies, pip_data_exclude )
diff --git a/python/pip_install/extract_wheels/lib/whl_filegroup_test.py b/python/pip_install/extract_wheels/lib/whl_filegroup_test.py index a338a14..1209456 100644 --- a/python/pip_install/extract_wheels/lib/whl_filegroup_test.py +++ b/python/pip_install/extract_wheels/lib/whl_filegroup_test.py
@@ -17,7 +17,7 @@ )[2:] # Take off the leading // from the returned label. # Assert that the raw wheel ends up in the package. self.assertIn(wheel_name, os.listdir(generated_bazel_dir)) - with open("{}/BUILD".format(generated_bazel_dir)) as build_file: + with open("{}/BUILD.bazel".format(generated_bazel_dir)) as build_file: build_file_content = build_file.read() self.assertIn('filegroup', build_file_content)