@@ -201,63 +201,6 @@ def generate_build_file_contents(
201
201
)
202
202
203
203
204
- def generate_requirements_file_contents (repo_name : str , targets : Iterable [str ]) -> str :
205
- """Generate a requirements.bzl file for a given pip repository
206
-
207
- The file allows converting the PyPI name to a bazel label. Additionally, it adds a function which can glob all the
208
- installed dependencies.
209
-
210
- Args:
211
- repo_name: the name of the pip repository
212
- targets: a list of Bazel labels pointing to all the generated targets
213
-
214
- Returns:
215
- A complete requirements.bzl file as a string
216
- """
217
-
218
- sorted_targets = sorted (targets )
219
- requirement_labels = "," .join (sorted_targets )
220
- whl_requirement_labels = "," .join (
221
- '"{}:whl"' .format (target .strip ('"' )) for target in sorted_targets
222
- )
223
- return textwrap .dedent (
224
- """\
225
- all_requirements = [{requirement_labels}]
226
-
227
- all_whl_requirements = [{whl_requirement_labels}]
228
-
229
- def requirement(name):
230
- name_key = name.replace("-", "_").replace(".", "_").lower()
231
- return "{repo}//pypi__" + name_key
232
-
233
- def whl_requirement(name):
234
- return requirement(name) + ":{whl_file_label}"
235
-
236
- def data_requirement(name):
237
- return requirement(name) + ":{data_label}"
238
-
239
- def dist_info_requirement(name):
240
- return requirement(name) + ":{dist_info_label}"
241
-
242
- def entry_point(pkg, script = None):
243
- if not script:
244
- script = pkg
245
- return requirement(pkg) + ":{entry_point_prefix}_" + script
246
-
247
- def install_deps():
248
- fail("install_deps() only works if you are creating an incremental repo. Did you mean to use pip_parse()?")
249
- """ .format (
250
- repo = repo_name ,
251
- requirement_labels = requirement_labels ,
252
- whl_requirement_labels = whl_requirement_labels ,
253
- whl_file_label = WHEEL_FILE_LABEL ,
254
- data_label = DATA_LABEL ,
255
- dist_info_label = DIST_INFO_LABEL ,
256
- entry_point_prefix = WHEEL_ENTRY_POINT_PREFIX ,
257
- )
258
- )
259
-
260
-
261
204
def sanitise_name (name : str , prefix : str ) -> str :
262
205
"""Sanitises the name to be compatible with Bazel labels.
263
206
0 commit comments