Skip to content

Commit a9af1b3

Browse files
committed
Consolidated changeset
1 parent 85eed2b commit a9af1b3

File tree

21 files changed

+1275
-175
lines changed

21 files changed

+1275
-175
lines changed

Cargo.Bazel.lock

Lines changed: 69 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"checksum": "7c8cd2683de76ab9fae29a74881389aefee00f8d83f53bd006aba44b4dd3731d",
2+
"checksum": "eb371dc49c5639c18e7f0415686de673ae7f83a972b6fd8823550485f5f63bea",
33
"crates": {
44
"addr2line 0.24.2": {
55
"name": "addr2line",
@@ -9978,14 +9978,14 @@
99789978
],
99799979
"license_file": "LICENSE.txt"
99809980
},
9981-
"pathdiff 0.2.2": {
9981+
"pathdiff 0.2.3": {
99829982
"name": "pathdiff",
9983-
"version": "0.2.2",
9983+
"version": "0.2.3",
99849984
"package_url": "https://github.com/Manishearth/pathdiff",
99859985
"repository": {
99869986
"Http": {
9987-
"url": "https://static.crates.io/crates/pathdiff/0.2.2/download",
9988-
"sha256": "d61c5ce1153ab5b689d0c074c4e7fc613e942dfb7dd9eea5ab202d2ad91fe361"
9987+
"url": "https://static.crates.io/crates/pathdiff/0.2.3/download",
9988+
"sha256": "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
99899989
}
99909990
},
99919991
"targets": [
@@ -10008,7 +10008,7 @@
1000810008
"**"
1000910009
],
1001010010
"edition": "2018",
10011-
"version": "0.2.2"
10011+
"version": "0.2.3"
1001210012
},
1001310013
"license": "MIT/Apache-2.0",
1001410014
"license_ids": [
@@ -10856,6 +10856,14 @@
1085610856
"id": "miette 7.2.0",
1085710857
"target": "miette"
1085810858
},
10859+
{
10860+
"id": "pathdiff 0.2.3",
10861+
"target": "pathdiff"
10862+
},
10863+
{
10864+
"id": "relative-path 1.9.3",
10865+
"target": "relative_path"
10866+
},
1085910867
{
1086010868
"id": "tempfile 3.13.0",
1086110869
"target": "tempfile"
@@ -10891,6 +10899,10 @@
1089110899
{
1089210900
"id": "uv-virtualenv 0.0.4",
1089310901
"target": "uv_virtualenv"
10902+
},
10903+
{
10904+
"id": "walkdir 2.5.0",
10905+
"target": "walkdir"
1089410906
}
1089510907
],
1089610908
"selects": {}
@@ -12203,6 +12215,51 @@
1220312215
],
1220412216
"license_file": "LICENSE-APACHE"
1220512217
},
12218+
"relative-path 1.9.3": {
12219+
"name": "relative-path",
12220+
"version": "1.9.3",
12221+
"package_url": "https://github.com/udoprog/relative-path",
12222+
"repository": {
12223+
"Http": {
12224+
"url": "https://static.crates.io/crates/relative-path/1.9.3/download",
12225+
"sha256": "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2"
12226+
}
12227+
},
12228+
"targets": [
12229+
{
12230+
"Library": {
12231+
"crate_name": "relative_path",
12232+
"crate_root": "src/lib.rs",
12233+
"srcs": {
12234+
"allow_empty": true,
12235+
"include": [
12236+
"**/*.rs"
12237+
]
12238+
}
12239+
}
12240+
}
12241+
],
12242+
"library_target_name": "relative_path",
12243+
"common_attrs": {
12244+
"compile_data_glob": [
12245+
"**"
12246+
],
12247+
"crate_features": {
12248+
"common": [
12249+
"default"
12250+
],
12251+
"selects": {}
12252+
},
12253+
"edition": "2021",
12254+
"version": "1.9.3"
12255+
},
12256+
"license": "MIT OR Apache-2.0",
12257+
"license_ids": [
12258+
"Apache-2.0",
12259+
"MIT"
12260+
],
12261+
"license_file": null
12262+
},
1220612263
"rend 0.5.2": {
1220712264
"name": "rend",
1220812265
"version": "0.5.2",
@@ -21868,7 +21925,7 @@
2186821925
"target": "mailparse"
2186921926
},
2187021927
{
21871-
"id": "pathdiff 0.2.2",
21928+
"id": "pathdiff 0.2.3",
2187221929
"target": "pathdiff"
2187321930
},
2187421931
{
@@ -22997,7 +23054,7 @@
2299723054
"target": "itertools"
2299823055
},
2299923056
{
23000-
"id": "pathdiff 0.2.2",
23057+
"id": "pathdiff 0.2.3",
2300123058
"target": "pathdiff"
2300223059
},
2300323060
{
@@ -27568,6 +27625,8 @@
2756827625
"clap 4.5.20",
2756927626
"itertools 0.13.0",
2757027627
"miette 7.2.0",
27628+
"pathdiff 0.2.3",
27629+
"relative-path 1.9.3",
2757127630
"tempfile 3.13.0",
2757227631
"thiserror 1.0.65",
2757327632
"uv-cache 0.0.1",
@@ -27576,7 +27635,8 @@
2757627635
"uv-install-wheel 0.0.1",
2757727636
"uv-pypi-types 0.0.1",
2757827637
"uv-python 0.0.1",
27579-
"uv-virtualenv 0.0.4"
27638+
"uv-virtualenv 0.0.4",
27639+
"walkdir 2.5.0"
2758027640
],
2758127641
"direct_dev_deps": []
2758227642
}

Cargo.lock

Lines changed: 11 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/py_venv/BUILD.bazel

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
load("@aspect_bazel_lib//lib:expand_template.bzl", "expand_template")
2+
load("//py:defs.bzl", "py_binary")
3+
load("//py/private:py_venv.bzl", "py_venv", "py_venv_binary")
4+
load("@rules_pkg//pkg:zip.bzl", "pkg_zip")
5+
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "filter_directory")
6+
7+
expand_template(
8+
name = "stamped",
9+
stamp_substitutions = {
10+
"<BUILD_TIMESTAMP>": "{{BUILD_TIMESTAMP}}",
11+
},
12+
template = "say.py",
13+
)
14+
15+
py_venv(
16+
name = "venv",
17+
deps = [
18+
"@pypi_cowsay//:pkg",
19+
],
20+
)
21+
22+
py_venv_binary(
23+
name = "external_venv",
24+
srcs = [
25+
":stamped"
26+
],
27+
# FIXME: Allow use of venv from a separate target?
28+
venv = ":venv",
29+
main = ":stamped",
30+
imports = [
31+
"."
32+
],
33+
)
34+
35+
py_venv_binary(
36+
name = "internal_venv",
37+
srcs = [
38+
":stamped"
39+
],
40+
main = ":stamped",
41+
deps = [
42+
"@pypi_cowsay//:pkg",
43+
],
44+
imports = [
45+
"."
46+
],
47+
48+
)

examples/py_venv/say.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env python3
2+
3+
print("---")
4+
import _virtualenv
5+
6+
output_base = _virtualenv.__file__.split("/execroot/")[0]
7+
execroot = f"{output_base}/execroot"
8+
external = f"{output_base}/external"
9+
runfiles = _virtualenv.__file__.split(".runfiles/")[0] + ".runfiles"
10+
11+
def _simlify(s):
12+
if isinstance(s, str):
13+
return s \
14+
.replace(runfiles, "${RUNFILES}") \
15+
.replace(execroot, "${BAZEL_EXECROOT}") \
16+
.replace(external, "${BAZEL_EXTERNAL}") \
17+
.replace(output_base, "${BAZEL_BASE}")
18+
19+
elif isinstance(s, list):
20+
return [_simlify(it) for it in s]
21+
22+
print("virtualenv:", _simlify(_virtualenv.__file__))
23+
import sys
24+
print("sys.prefix:", _simlify(sys.prefix))
25+
print("sys.path:")
26+
for it in _simlify(sys.path):
27+
print(" -", it)
28+
import site
29+
print("site.PREFIXES:")
30+
for it in _simlify(site.PREFIXES):
31+
print(" -", it)
32+
33+
import cowsay
34+
35+
cowsay.cow('hello py_binary! (built at <BUILD_TIMESTAMP>)')

py/private/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ exports_files(
99
[
1010
"run.tmpl.sh",
1111
"venv.tmpl.sh",
12+
"venv_binary.tmpl.sh",
1213
"pytest.py.tmpl",
1314
],
1415
visibility = ["//visibility:public"],

0 commit comments

Comments
 (0)