diff --git a/e2e/test_build_steps.sh b/e2e/test_build_steps.sh index 1ef9670f..6f8d6e83 100755 --- a/e2e/test_build_steps.sh +++ b/e2e/test_build_steps.sh @@ -54,8 +54,7 @@ build_wheel() { --work-dir "$OUTDIR/work-dir" \ --sdists-repo "$OUTDIR/sdists-repo" \ --wheels-repo "$OUTDIR/wheels-repo" \ - --wheel-server-url "${WHEEL_SERVER_URL}" \ - step prepare-build "$dist" "$version" + step prepare-build --wheel-server-url "${WHEEL_SERVER_URL}" "$dist" "$version" # Build an updated sdist fromager \ @@ -71,8 +70,7 @@ build_wheel() { --work-dir "$OUTDIR/work-dir" \ --sdists-repo "$OUTDIR/sdists-repo" \ --wheels-repo "$OUTDIR/wheels-repo" \ - --wheel-server-url "${WHEEL_SERVER_URL}" \ - step build-wheel "$dist" "$version" + step build-wheel --wheel-server-url "${WHEEL_SERVER_URL}" "$dist" "$version" # Move the built wheel into place mv "$OUTDIR"/wheels-repo/build/*.whl "$OUTDIR/wheels-repo/downloads/" diff --git a/e2e/test_pep517_build_sdist.sh b/e2e/test_pep517_build_sdist.sh index 0661c361..1427a20c 100755 --- a/e2e/test_pep517_build_sdist.sh +++ b/e2e/test_pep517_build_sdist.sh @@ -36,8 +36,7 @@ fromager \ --work-dir "$OUTDIR/work-dir" \ --sdists-repo "$OUTDIR/sdists-repo" \ --wheels-repo "$OUTDIR/wheels-repo" \ - --wheel-server-url "https://pypi.org/simple/" \ - step prepare-build "$DIST" "$VERSION" + step prepare-build --wheel-server-url "https://pypi.org/simple/" "$DIST" "$VERSION" # Build an updated sdist rm -rf "$OUTDIR/sdists-repo/builds" diff --git a/e2e/test_report_missing_dependency.sh b/e2e/test_report_missing_dependency.sh index 15e4a20f..86199206 100755 --- a/e2e/test_report_missing_dependency.sh +++ b/e2e/test_report_missing_dependency.sh @@ -60,8 +60,7 @@ fromager \ --work-dir "$OUTDIR/work-dir" \ --sdists-repo "$OUTDIR/sdists-repo" \ --wheels-repo "$OUTDIR/wheels-repo" \ - --wheel-server-url "${WHEEL_SERVER_URL}" \ - step prepare-build "$DIST" "$VERSION" \ + step prepare-build --wheel-server-url "${WHEEL_SERVER_URL}" "$DIST" "$VERSION" \ || echo "Got expected build error" if grep -q "MissingDependency" "$build_log"; then diff --git a/src/fromager/__main__.py b/src/fromager/__main__.py index 2363fdbc..42661a11 100644 --- a/src/fromager/__main__.py +++ b/src/fromager/__main__.py @@ -110,12 +110,6 @@ type=clickext.ClickPath(), help="location of the constraints file", ) -@click.option( - "--wheel-server-url", - default="", - type=str, - help="URL for the wheel server for builds", -) @click.option( "--cleanup/--no-cleanup", default=True, @@ -149,7 +143,6 @@ def main( settings_file: pathlib.Path, settings_dir: pathlib.Path, constraints_file: pathlib.Path, - wheel_server_url: str, cleanup: bool, variant: str, jobs: int | None, @@ -203,7 +196,6 @@ def main( logger.info(f"patches dir: {patches_dir}") logger.info(f"maximum concurrent jobs: {jobs}") logger.info(f"constraints file: {constraints_file}") - logger.info(f"wheel server url: {wheel_server_url}") logger.info(f"network isolation: {network_isolation}") overrides.log_overrides() @@ -223,7 +215,6 @@ def main( sdists_repo=sdists_repo, wheels_repo=wheels_repo, work_dir=work_dir, - wheel_server_url=wheel_server_url, cleanup=cleanup, variant=variant, network_isolation=network_isolation, diff --git a/src/fromager/commands/build.py b/src/fromager/commands/build.py index bbbf2c78..f504096a 100644 --- a/src/fromager/commands/build.py +++ b/src/fromager/commands/build.py @@ -50,12 +50,19 @@ def __lt__(self, other): @click.command() +@click.option( + "--wheel-server-url", + default="", + type=str, + help="URL for the wheel server for builds", +) @click.argument("dist_name") @click.argument("dist_version", type=clickext.PackageVersion()) @click.argument("sdist_server_url") @click.pass_obj def build( wkctx: context.WorkContext, + wheel_server_url: str, dist_name: str, dist_version: Version, sdist_server_url: str, @@ -81,6 +88,7 @@ def build( separately. """ + wkctx.wheel_server_url = wheel_server_url server.start_wheel_server(wkctx) req = Requirement(f"{dist_name}=={dist_version}") source_url, version = sources.resolve_source( diff --git a/src/fromager/commands/step.py b/src/fromager/commands/step.py index 2c058df7..a338a391 100644 --- a/src/fromager/commands/step.py +++ b/src/fromager/commands/step.py @@ -142,11 +142,18 @@ def _find_source_root_dir( @step.command() +@click.option( + "--wheel-server-url", + default="", + type=str, + help="URL for the wheel server for builds", +) @click.argument("dist_name") @click.argument("dist_version", type=clickext.PackageVersion()) @click.pass_obj def prepare_build( wkctx: context.WorkContext, + wheel_server_url: str, dist_name: str, dist_version: Version, ) -> None: @@ -157,6 +164,7 @@ def prepare_build( DIST_VERSION is the version to process """ + wkctx.wheel_server_url = wheel_server_url server.start_wheel_server(wkctx) req = Requirement(f"{dist_name}=={dist_version}") source_root_dir = _find_source_root_dir(wkctx, wkctx.work_dir, req, dist_version) @@ -166,11 +174,18 @@ def prepare_build( @step.command() +@click.option( + "--wheel-server-url", + default="", + type=str, + help="URL for the wheel server for builds", +) @click.argument("dist_name") @click.argument("dist_version", type=clickext.PackageVersion()) @click.pass_obj def build_wheel( wkctx: context.WorkContext, + wheel_server_url: str, dist_name: str, dist_version: Version, ) -> None: @@ -181,8 +196,10 @@ def build_wheel( DIST_VERSION is the version to process """ + wkctx.wheel_server_url = wheel_server_url req = Requirement(f"{dist_name}=={dist_version}") source_root_dir = _find_source_root_dir(wkctx, wkctx.work_dir, req, dist_version) + server.start_wheel_server(wkctx) build_env = build_environment.BuildEnvironment(wkctx, source_root_dir.parent, None) wheel_filename = wheels.build_wheel( ctx=wkctx, diff --git a/src/fromager/context.py b/src/fromager/context.py index e19cb29c..c739ac6c 100644 --- a/src/fromager/context.py +++ b/src/fromager/context.py @@ -29,7 +29,6 @@ def __init__( sdists_repo: pathlib.Path, wheels_repo: pathlib.Path, work_dir: pathlib.Path, - wheel_server_url: str, cleanup: bool = True, variant: str = "cpu", network_isolation: bool = False, @@ -61,7 +60,7 @@ def __init__( self.wheels_prebuilt = self.wheels_repo / "prebuilt" self.wheel_server_dir = self.wheels_repo / "simple" self.work_dir = pathlib.Path(work_dir).absolute() - self.wheel_server_url = wheel_server_url + self.wheel_server_url = "" self.logs_dir = self.work_dir / "logs" self.cleanup = cleanup self.variant = variant diff --git a/tests/conftest.py b/tests/conftest.py index 4cefb8cf..933612f0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -25,7 +25,6 @@ def tmp_context(tmp_path: pathlib.Path) -> context.WorkContext: sdists_repo=tmp_path / "sdists-repo", wheels_repo=tmp_path / "wheels-repo", work_dir=tmp_path / "work-dir", - wheel_server_url="", variant=variant, ) ctx.setup() @@ -52,7 +51,6 @@ def testdata_context( sdists_repo=tmp_path / "sdists-repo", wheels_repo=tmp_path / "wheels-repo", work_dir=tmp_path / "work-dir", - wheel_server_url="", ) ctx.setup() return ctx diff --git a/tests/test_context.py b/tests/test_context.py index f9b037b1..917e685f 100644 --- a/tests/test_context.py +++ b/tests/test_context.py @@ -13,7 +13,6 @@ def test_pip_constraints_args(tmp_path): sdists_repo=tmp_path / "sdists-repo", wheels_repo=tmp_path / "wheels-repo", work_dir=tmp_path / "work-dir", - wheel_server_url="", ) ctx.setup() assert ["--constraint", os.fspath(constraints_file)] == ctx.pip_constraint_args @@ -25,7 +24,6 @@ def test_pip_constraints_args(tmp_path): sdists_repo=tmp_path / "sdists-repo", wheels_repo=tmp_path / "wheels-repo", work_dir=tmp_path / "work-dir", - wheel_server_url="", ) ctx.setup() assert [] == ctx.pip_constraint_args