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