Skip to content

Commit ee716a1

Browse files
[build] Fix Wheel generation include devtools files
1 parent c9b8d03 commit ee716a1

2 files changed

Lines changed: 72 additions & 0 deletions

File tree

WORKSPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ http_archive(
9393
name = "rules_python",
9494
patches = [
9595
"//py:rules_python_any_version_wheel.patch",
96+
"//py:rules_python_wheel_directory_check.patch",
9697
],
9798
sha256 = "ddb2e1298684defde2f5e466d96e572119f30f9e2a901a7a81474fd4fa9f6d52",
9899
strip_prefix = "rules_python-dd7f9c5f01bafbfea08c44092b6b0c8fc8fcb77f",
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
diff --git experimental/examples/wheel/BUILD experimental/examples/wheel/BUILD
2+
index 8916423..8a4aeb4 100644
3+
--- experimental/examples/wheel/BUILD
4+
+++ experimental/examples/wheel/BUILD
5+
@@ -31,6 +31,20 @@ py_library(
6+
],
7+
)
8+
9+
+py_library(
10+
+ name = "main_with_gen_data",
11+
+ srcs = ["main.py"],
12+
+ data = [
13+
+ ":gen_dir",
14+
+ ],
15+
+)
16+
+
17+
+genrule(
18+
+ name="gen_dir",
19+
+ outs=["someDir"],
20+
+ cmd="mkdir -p $@",
21+
+)
22+
+
23+
# Package just a specific py_libraries, without their dependencies
24+
py_wheel(
25+
name = "minimal_with_py_library",
26+
@@ -53,6 +67,12 @@ py_package(
27+
deps = [":main"],
28+
)
29+
30+
+py_package(
31+
+ name = "example_pkg_with_data",
32+
+ packages = ["experimental.examples.wheel"],
33+
+ deps = [":main_with_gen_data"]
34+
+)
35+
+
36+
py_wheel(
37+
name = "minimal_with_py_package",
38+
# Package data. We're building "example_minimal_package-0.0.1-py3-none-any.whl"
39+
@@ -131,6 +151,16 @@ py_wheel(
40+
],
41+
)
42+
43+
+py_wheel(
44+
+ name = "use_genrule_with_dir_in_outs",
45+
+ distribution = "use_genrule_with_dir_in_outs",
46+
+ python_tag = "py3",
47+
+ version = "0.0.1",
48+
+ deps = [
49+
+ ":example_pkg_with_data"
50+
+ ]
51+
+)
52+
+
53+
py_test(
54+
name = "wheel_test",
55+
srcs = ["wheel_test.py"],
56+
diff --git experimental/rules_python/wheelmaker.py experimental/rules_python/wheelmaker.py
57+
index 1b3261d..1a28df2 100644
58+
--- experimental/rules_python/wheelmaker.py
59+
+++ experimental/rules_python/wheelmaker.py
60+
@@ -101,6 +101,11 @@ class WheelMaker(object):
61+
62+
return normalized_arcname
63+
64+
+ # If anywhere in the dependency tree a directory is set
65+
+ # it will be passed in as an input file and we need to
66+
+ # ignore.
67+
+ if os.path.isdir(real_filename):
68+
+ return
69+
arcname = arcname_from(package_filename)
70+
71+
self._zipfile.write(real_filename, arcname=arcname)

0 commit comments

Comments
 (0)