Skip to content

Commit c654d0a

Browse files
committed
[NO TESTS] WIP
1 parent deaea52 commit c654d0a

File tree

2 files changed

+14
-23
lines changed

2 files changed

+14
-23
lines changed

uv/private/extension.bzl

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -374,12 +374,6 @@ def parse_ini(lines):
374374
return dict
375375

376376
def _collect_entrypoints(module_ctx, lock_specs):
377-
# Collect all the packages anyone's allowing entrypoints for
378-
packages_to_collect = {}
379-
for mod in module_ctx.modules:
380-
for it in mod.tags.discover_entrypoints:
381-
packages_to_collect[normalize_name(it.requirement)] = 1
382-
383377
entrypoints = {}
384378

385379
# Collect predeclared entrypoints
@@ -389,7 +383,11 @@ def _collect_entrypoints(module_ctx, lock_specs):
389383
entrypoints.setdefault(r, {})
390384
entrypoints[r][normalize_name(it.name)] = it.entrypoint
391385

392-
print(packages_to_collect)
386+
# Collect all the packages anyone's allowing entrypoints for
387+
packages_to_collect = {}
388+
for mod in module_ctx.modules:
389+
for it in mod.tags.discover_entrypoints:
390+
packages_to_collect[normalize_name(it.requirement)] = 1
393391

394392
for hub_name, venvs in lock_specs.items():
395393
for venv_name, lock in venvs.items():
@@ -419,19 +417,14 @@ def _collect_entrypoints(module_ctx, lock_specs):
419417
"*.dist-info/entry_points.txt",
420418
],
421419
)
422-
print(debug(res))
423420
if res.return_code == 0:
424421
entrypoints.setdefault(package["name"], {})
425422
whl_entrypoints = parse_ini(res.stdout)
426-
print(package["name"], res.stdout, whl_entrypoints)
427423
for name, entrypoint in whl_entrypoints.get("console_script", {}).items():
428424
entrypoints[package["name"]][normalize_name(name)] = entrypoint
429425

430426
packages_to_collect.pop(package["name"])
431427

432-
else:
433-
print(file, res.exit_code, res.stderr)
434-
435428
return entrypoints
436429

437430
def _whl_install_repos(module_ctx, lock_specs):
@@ -670,7 +663,6 @@ def _uv_impl(module_ctx):
670663

671664
# Collect declared entrypoints for packages
672665
entrypoints = _collect_entrypoints(module_ctx, lock_specs)
673-
print("got entrypoints", entrypoints)
674666

675667
# Roll through and create sdist and whl repos for all configured sources
676668
# Note that these have no deps to this point
Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
load("@bazel_lib//lib:expand_template.bzl", "expand_template")
22
load("//py/unstable:defs.bzl", "py_venv_binary")
33

4-
54
def py_entrypoint_binary(
6-
name,
7-
coordinate,
8-
deps,
9-
visibility = ["//visibility:public"],
10-
):
5+
name,
6+
coordinate,
7+
deps,
8+
visibility = ["//visibility:public"]):
119
main = "_{}_entrypoint".format(name)
10+
1211
# <name> = <package_or_module>[:<object>[.<attr>[.<nested-attr>]*]]
1312
package, symbol = coordinate.split(":")
1413

1514
if "." in symbol:
1615
fn, tail = symbol.split(".", 1)
17-
alias = "{fn} = {fn}.{tail}\n".format(fn=fn, tail=tail)
16+
alias = "{fn} = {fn}.{tail}\n".format(fn = fn, tail = tail)
1817
else:
1918
fn = symbol
2019
tail = ""
@@ -27,14 +26,14 @@ def py_entrypoint_binary(
2726
substitutions = {
2827
"{{package}}": package,
2928
"{{fn}}": fn,
30-
"{{alias}}": alias
29+
"{{alias}}": alias,
3130
},
3231
)
33-
32+
3433
py_venv_binary(
3534
name = name,
3635
main = main + ".py",
3736
srcs = [main],
3837
deps = deps,
39-
visibility = visibility
38+
visibility = visibility,
4039
)

0 commit comments

Comments
 (0)