10
10
11
11
WHEEL_FILE_LABEL = "whl"
12
12
PY_LIBRARY_LABEL = "pkg"
13
+ DATA_LABEL = "data"
14
+ DIST_INFO_LABEL = "dist_info"
13
15
14
16
15
17
def generate_build_file_contents (
@@ -33,14 +35,24 @@ def generate_build_file_contents(
33
35
34
36
return textwrap .dedent (
35
37
"""\
38
+ load("@rules_python//python:defs.bzl", "py_library")
39
+
36
40
package(default_visibility = ["//visibility:public"])
37
41
38
- load("@rules_python//python:defs.bzl", "py_library")
42
+ filegroup(
43
+ name = "{dist_info_label}",
44
+ srcs = glob(["*.dist-info/**"], allow_empty = True),
45
+ )
46
+
47
+ filegroup(
48
+ name = "{data_label}",
49
+ srcs = glob(["*.data/**"], allow_empty = True),
50
+ )
39
51
40
52
filegroup(
41
- name= "{whl_file_label}",
42
- srcs= glob(["*.whl"], allow_empty = True),
43
- data= [{whl_file_deps}]
53
+ name = "{whl_file_label}",
54
+ srcs = glob(["*.whl"], allow_empty = True),
55
+ data = [{whl_file_deps}],
44
56
)
45
57
46
58
py_library(
@@ -58,6 +70,8 @@ def generate_build_file_contents(
58
70
data_exclude = json .dumps (data_exclude ),
59
71
whl_file_label = WHEEL_FILE_LABEL ,
60
72
whl_file_deps = "," .join (whl_file_deps ),
73
+ data_label = DATA_LABEL ,
74
+ dist_info_label = DIST_INFO_LABEL ,
61
75
)
62
76
)
63
77
@@ -92,14 +106,23 @@ def requirement(name):
92
106
return "{repo}//pypi__" + name_key
93
107
94
108
def whl_requirement(name):
95
- return requirement(name) + ":whl"
109
+ return requirement(name) + ":{whl_file_label}"
110
+
111
+ def data_requirement(name):
112
+ return requirement(name) + ":{data_label}"
113
+
114
+ def dist_info_requirement(name):
115
+ return requirement(name) + ":{dist_info_label}"
96
116
97
117
def install_deps():
98
118
fail("install_deps() only works if you are creating an incremental repo. Did you mean to use pip_parse()?")
99
119
""" .format (
100
120
repo = repo_name ,
101
121
requirement_labels = requirement_labels ,
102
122
whl_requirement_labels = whl_requirement_labels ,
123
+ whl_file_label = WHEEL_FILE_LABEL ,
124
+ data_label = DATA_LABEL ,
125
+ dist_info_label = DIST_INFO_LABEL ,
103
126
)
104
127
)
105
128
0 commit comments