Skip to content

Commit 6485051

Browse files
committed
Expand linux_portable_build to build Py packages
Expands the `linux_portable_build` script to build Python packages (sdist and wheels). Progress on #369.
1 parent 0dfb440 commit 6485051

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
set -e
3+
set -o pipefail
4+
trap 'kill -TERM 0' INT
5+
6+
set -o xtrace
7+
pip install -r /therock/src/requirements.txt
8+
time python /therock/src/build_tools/linux_python_package.py \
9+
--artifact-dir /therock/artifacts \
10+
--dest-dir /therock/output \
11+
"$@"

build_tools/linux_portable_build.py

+32
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
1818
* `--image`: Change the default build image
1919
* `--output-dir`: Change the output directory, which contains caches and build
20+
or Python packages
21+
* `--artifact-dir`: Change the source artifacts/ directory to build Python
22+
packages from
2023
"""
2124

2225
import argparse
@@ -57,6 +60,14 @@ def do_build(args: argparse.Namespace, *, rest_args: list[str]):
5760
]
5861
)
5962

63+
if args.build_python_only:
64+
cl.extend(
65+
[
66+
"--mount",
67+
f"type=bind,src={args.artifact_dir},dst=/therock/artifacts",
68+
]
69+
)
70+
6071
if args.interactive:
6172
cl.extend(
6273
[
@@ -65,6 +76,15 @@ def do_build(args: argparse.Namespace, *, rest_args: list[str]):
6576
"/bin/bash",
6677
]
6778
)
79+
elif args.build_python_only:
80+
cl.extend(
81+
[
82+
args.image,
83+
"/bin/bash",
84+
"/therock/src/build_tools/detail/linux_python_package_in_container.sh",
85+
]
86+
)
87+
cl += rest_args
6888
else:
6989
cl.extend(
7090
[
@@ -122,6 +142,18 @@ def main(argv: list[str]):
122142
action=argparse.BooleanOptionalAction,
123143
help="Enter interactive shell vs invoking the build",
124144
)
145+
p.add_argument(
146+
"--build-python-only",
147+
action="store_true",
148+
default=False,
149+
help="Build only Python packages",
150+
)
151+
p.add_argument(
152+
"--artifact-dir",
153+
default=Path(REPO_DIR / "output-linux-portable" / "build" / "artifacts"),
154+
type=Path,
155+
help="Source artifacts/ dir from a build",
156+
)
125157

126158
args = p.parse_args(argv)
127159
do_build(args, rest_args=rest_args)

0 commit comments

Comments
 (0)