Skip to content

Commit d90bc08

Browse files
authored
Merge pull request #506 from shubhbapna/remove-wheel-server-url
remove `--wheel-server-url` arg
2 parents 848e309 + 0e94970 commit d90bc08

11 files changed

+37
-48
lines changed

e2e/test_build_order.sh

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,6 @@ fromager \
2121
# Save the build order file but remove everything else.
2222
cp "$OUTDIR/work-dir/build-order.json" "$OUTDIR/"
2323

24-
start_local_wheel_server
25-
26-
# copy sdists to wheel-repo/download so that it can be put on local pypi index server (even later when fromager calls update_wheel_mirror)
27-
rm -r "$OUTDIR/wheels-repo" "$OUTDIR/work-dir"
28-
mkdir -p "$OUTDIR/wheels-repo/downloads"
29-
30-
# IMPORTANT: cp -r behaves differently on macos: adding a trailing / to the src directory will end up copying the contents of that directory
31-
cp -r "$OUTDIR/sdists-repo/downloads" "$OUTDIR/wheels-repo/"
32-
rm -r "$OUTDIR/sdists-repo"
33-
34-
pypi-mirror create -c -d "$OUTDIR/wheels-repo/downloads/" -m "$OUTDIR/wheels-repo/simple/"
35-
3624
# Rebuild everything
3725
log="$OUTDIR/build-logs/${DIST}-build.log"
3826
fromager \
@@ -78,7 +66,6 @@ $pass
7866
# Rebuild everything with the skip flag and verify we reuse the existing wheels
7967
log="$OUTDIR/build-logs/${DIST}-build-skip.log"
8068
fromager \
81-
--wheel-server-url $WHEEL_SERVER_URL \
8269
--log-file "$log" \
8370
--work-dir "$OUTDIR/work-dir" \
8471
--sdists-repo "$OUTDIR/sdists-repo" \
@@ -103,7 +90,6 @@ $pass
10390
export FROMAGER_BUILD_SEQUENCE_SKIP_EXISTING=true
10491
log="$OUTDIR/build-logs/${DIST}-build-skip-env.log"
10592
fromager \
106-
--wheel-server-url $WHEEL_SERVER_URL \
10793
--log-file "$log" \
10894
--work-dir "$OUTDIR/work-dir" \
10995
--sdists-repo "$OUTDIR/sdists-repo" \
@@ -127,7 +113,6 @@ $pass
127113
# bootstrap stevedore with 2 changelog.
128114
log="$OUTDIR/build-logs/${DIST}-build-changelog.log"
129115
fromager \
130-
--wheel-server-url $WHEEL_SERVER_URL \
131116
--log-file "$log" \
132117
--work-dir "$OUTDIR/work-dir" \
133118
--sdists-repo "$OUTDIR/sdists-repo" \

e2e/test_build_steps.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ build_wheel() {
5454
--work-dir "$OUTDIR/work-dir" \
5555
--sdists-repo "$OUTDIR/sdists-repo" \
5656
--wheels-repo "$OUTDIR/wheels-repo" \
57-
--wheel-server-url "${WHEEL_SERVER_URL}" \
58-
step prepare-build "$dist" "$version"
57+
step prepare-build --wheel-server-url "${WHEEL_SERVER_URL}" "$dist" "$version"
5958

6059
# Build an updated sdist
6160
fromager \
@@ -71,8 +70,7 @@ build_wheel() {
7170
--work-dir "$OUTDIR/work-dir" \
7271
--sdists-repo "$OUTDIR/sdists-repo" \
7372
--wheels-repo "$OUTDIR/wheels-repo" \
74-
--wheel-server-url "${WHEEL_SERVER_URL}" \
75-
step build-wheel "$dist" "$version"
73+
step build-wheel --wheel-server-url "${WHEEL_SERVER_URL}" "$dist" "$version"
7674

7775
# Move the built wheel into place
7876
mv "$OUTDIR"/wheels-repo/build/*.whl "$OUTDIR/wheels-repo/downloads/"

e2e/test_pep517_build_sdist.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ fromager \
3636
--work-dir "$OUTDIR/work-dir" \
3737
--sdists-repo "$OUTDIR/sdists-repo" \
3838
--wheels-repo "$OUTDIR/wheels-repo" \
39-
--wheel-server-url "https://pypi.org/simple/" \
40-
step prepare-build "$DIST" "$VERSION"
39+
step prepare-build --wheel-server-url "https://pypi.org/simple/" "$DIST" "$VERSION"
4140

4241
# Build an updated sdist
4342
rm -rf "$OUTDIR/sdists-repo/builds"

e2e/test_prebuilt_wheels_alt_server.sh

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
# -*- indent-tabs-mode: nil; tab-width: 2; sh-indentation: 2; -*-
33

4-
# Test that when resolving a pre-built wheel the --wheel-server-url is
4+
# Test that when resolving a pre-built wheel the local wheel server is
55
# given preference over PyPI.org.
66

77
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@@ -21,8 +21,6 @@ fromager \
2121
--work-dir="$INIT/work-dir" \
2222
bootstrap "${DIST}==${VERSION}"
2323

24-
start_local_wheel_server "$INIT/wheels-repo"
25-
2624
# Modify the wheel so we can identify it as coming from the right
2725
# server.
2826
cd "$OUTDIR"
@@ -36,9 +34,6 @@ rm "$filename"
3634
zip -r "$filename" flit_core*
3735
cp "$filename" "$INIT/wheels-repo/downloads"
3836

39-
# Make sure the mirror is up to date
40-
pypi-mirror create -d "$INIT/wheels-repo/downloads/" -m "$INIT/wheels-repo/simple/"
41-
4237
TESTDIR="$OUTDIR/test"
4338
mkdir -p "$TESTDIR"
4439
cd "$TESTDIR"
@@ -54,8 +49,10 @@ EOF
5449
# the local server.
5550
fromager \
5651
-v \
57-
--wheel-server-url "$WHEEL_SERVER_URL" \
5852
--settings-dir="$TESTDIR/overrides/settings" \
53+
--sdists-repo="$INIT/sdists-repo" \
54+
--wheels-repo="$INIT/wheels-repo" \
55+
--work-dir="$INIT/work-dir" \
5956
bootstrap "${DIST}==${VERSION}" "wheel==0.43.0"
6057

6158
# Ensure we have both expected wheels
@@ -66,15 +63,15 @@ wheels-repo/downloads/wheel-0.43.0-0-py3-none-any.whl
6663

6764
pass=true
6865
for f in $EXPECTED_FILES; do
69-
if [ ! -f "$f" ]; then
70-
echo "FAIL: Did not find $OUTDIR/$f" 1>&2
66+
if [ ! -f "$INIT/$f" ]; then
67+
echo "FAIL: Did not find $INIT/$f" 1>&2
7168
pass=false
7269
fi
7370
done
7471

7572
# Ensure we got the right copy of the wheel for flit_core, with the
7673
# modified license file.
77-
cd wheels-repo/prebuilt
74+
cd $INIT/wheels-repo/prebuilt
7875
unzip "$filename"
7976
cat flit_core*.dist-info/LICENSE
8077
if ! grep -q "Test was here" flit_core*.dist-info/LICENSE; then

e2e/test_report_missing_dependency.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ fromager \
6060
--work-dir "$OUTDIR/work-dir" \
6161
--sdists-repo "$OUTDIR/sdists-repo" \
6262
--wheels-repo "$OUTDIR/wheels-repo" \
63-
--wheel-server-url "${WHEEL_SERVER_URL}" \
64-
step prepare-build "$DIST" "$VERSION" \
63+
step prepare-build --wheel-server-url "${WHEEL_SERVER_URL}" "$DIST" "$VERSION" \
6564
|| echo "Got expected build error"
6665

6766
if grep -q "MissingDependency" "$build_log"; then

src/fromager/__main__.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,6 @@
110110
type=clickext.ClickPath(),
111111
help="location of the constraints file",
112112
)
113-
@click.option(
114-
"--wheel-server-url",
115-
default="",
116-
type=str,
117-
help="URL for the wheel server for builds",
118-
)
119113
@click.option(
120114
"--cleanup/--no-cleanup",
121115
default=True,
@@ -149,7 +143,6 @@ def main(
149143
settings_file: pathlib.Path,
150144
settings_dir: pathlib.Path,
151145
constraints_file: pathlib.Path,
152-
wheel_server_url: str,
153146
cleanup: bool,
154147
variant: str,
155148
jobs: int | None,
@@ -203,7 +196,6 @@ def main(
203196
logger.info(f"patches dir: {patches_dir}")
204197
logger.info(f"maximum concurrent jobs: {jobs}")
205198
logger.info(f"constraints file: {constraints_file}")
206-
logger.info(f"wheel server url: {wheel_server_url}")
207199
logger.info(f"network isolation: {network_isolation}")
208200
overrides.log_overrides()
209201

@@ -223,7 +215,6 @@ def main(
223215
sdists_repo=sdists_repo,
224216
wheels_repo=wheels_repo,
225217
work_dir=work_dir,
226-
wheel_server_url=wheel_server_url,
227218
cleanup=cleanup,
228219
variant=variant,
229220
network_isolation=network_isolation,

src/fromager/commands/build.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,19 @@ def __lt__(self, other):
5050

5151

5252
@click.command()
53+
@click.option(
54+
"--wheel-server-url",
55+
default="",
56+
type=str,
57+
help="URL for the wheel server for builds",
58+
)
5359
@click.argument("dist_name")
5460
@click.argument("dist_version", type=clickext.PackageVersion())
5561
@click.argument("sdist_server_url")
5662
@click.pass_obj
5763
def build(
5864
wkctx: context.WorkContext,
65+
wheel_server_url: str,
5966
dist_name: str,
6067
dist_version: Version,
6168
sdist_server_url: str,
@@ -81,6 +88,7 @@ def build(
8188
separately.
8289
8390
"""
91+
wkctx.wheel_server_url = wheel_server_url
8492
server.start_wheel_server(wkctx)
8593
req = Requirement(f"{dist_name}=={dist_version}")
8694
source_url, version = sources.resolve_source(

src/fromager/commands/step.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,18 @@ def _find_source_root_dir(
142142

143143

144144
@step.command()
145+
@click.option(
146+
"--wheel-server-url",
147+
default="",
148+
type=str,
149+
help="URL for the wheel server for builds",
150+
)
145151
@click.argument("dist_name")
146152
@click.argument("dist_version", type=clickext.PackageVersion())
147153
@click.pass_obj
148154
def prepare_build(
149155
wkctx: context.WorkContext,
156+
wheel_server_url: str,
150157
dist_name: str,
151158
dist_version: Version,
152159
) -> None:
@@ -157,6 +164,7 @@ def prepare_build(
157164
DIST_VERSION is the version to process
158165
159166
"""
167+
wkctx.wheel_server_url = wheel_server_url
160168
server.start_wheel_server(wkctx)
161169
req = Requirement(f"{dist_name}=={dist_version}")
162170
source_root_dir = _find_source_root_dir(wkctx, wkctx.work_dir, req, dist_version)
@@ -166,11 +174,18 @@ def prepare_build(
166174

167175

168176
@step.command()
177+
@click.option(
178+
"--wheel-server-url",
179+
default="",
180+
type=str,
181+
help="URL for the wheel server for builds",
182+
)
169183
@click.argument("dist_name")
170184
@click.argument("dist_version", type=clickext.PackageVersion())
171185
@click.pass_obj
172186
def build_wheel(
173187
wkctx: context.WorkContext,
188+
wheel_server_url: str,
174189
dist_name: str,
175190
dist_version: Version,
176191
) -> None:
@@ -181,8 +196,10 @@ def build_wheel(
181196
DIST_VERSION is the version to process
182197
183198
"""
199+
wkctx.wheel_server_url = wheel_server_url
184200
req = Requirement(f"{dist_name}=={dist_version}")
185201
source_root_dir = _find_source_root_dir(wkctx, wkctx.work_dir, req, dist_version)
202+
server.start_wheel_server(wkctx)
186203
build_env = build_environment.BuildEnvironment(wkctx, source_root_dir.parent, None)
187204
wheel_filename = wheels.build_wheel(
188205
ctx=wkctx,

src/fromager/context.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def __init__(
2929
sdists_repo: pathlib.Path,
3030
wheels_repo: pathlib.Path,
3131
work_dir: pathlib.Path,
32-
wheel_server_url: str,
3332
cleanup: bool = True,
3433
variant: str = "cpu",
3534
network_isolation: bool = False,
@@ -61,7 +60,7 @@ def __init__(
6160
self.wheels_prebuilt = self.wheels_repo / "prebuilt"
6261
self.wheel_server_dir = self.wheels_repo / "simple"
6362
self.work_dir = pathlib.Path(work_dir).absolute()
64-
self.wheel_server_url = wheel_server_url
63+
self.wheel_server_url = ""
6564
self.logs_dir = self.work_dir / "logs"
6665
self.cleanup = cleanup
6766
self.variant = variant

tests/conftest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ def tmp_context(tmp_path: pathlib.Path) -> context.WorkContext:
2525
sdists_repo=tmp_path / "sdists-repo",
2626
wheels_repo=tmp_path / "wheels-repo",
2727
work_dir=tmp_path / "work-dir",
28-
wheel_server_url="",
2928
variant=variant,
3029
)
3130
ctx.setup()
@@ -52,7 +51,6 @@ def testdata_context(
5251
sdists_repo=tmp_path / "sdists-repo",
5352
wheels_repo=tmp_path / "wheels-repo",
5453
work_dir=tmp_path / "work-dir",
55-
wheel_server_url="",
5654
)
5755
ctx.setup()
5856
return ctx

0 commit comments

Comments
 (0)