Skip to content

Commit

Permalink
remove wheel-server-url arg
Browse files Browse the repository at this point in the history
Signed-off-by: Shubh Bapna <[email protected]>
  • Loading branch information
Shubh Bapna committed Nov 13, 2024
1 parent 848e309 commit 0e94970
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 48 deletions.
15 changes: 0 additions & 15 deletions e2e/test_build_order.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,6 @@ fromager \
# Save the build order file but remove everything else.
cp "$OUTDIR/work-dir/build-order.json" "$OUTDIR/"

start_local_wheel_server

# 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)
rm -r "$OUTDIR/wheels-repo" "$OUTDIR/work-dir"
mkdir -p "$OUTDIR/wheels-repo/downloads"

# IMPORTANT: cp -r behaves differently on macos: adding a trailing / to the src directory will end up copying the contents of that directory
cp -r "$OUTDIR/sdists-repo/downloads" "$OUTDIR/wheels-repo/"
rm -r "$OUTDIR/sdists-repo"

pypi-mirror create -c -d "$OUTDIR/wheels-repo/downloads/" -m "$OUTDIR/wheels-repo/simple/"

# Rebuild everything
log="$OUTDIR/build-logs/${DIST}-build.log"
fromager \
Expand Down Expand Up @@ -78,7 +66,6 @@ $pass
# Rebuild everything with the skip flag and verify we reuse the existing wheels
log="$OUTDIR/build-logs/${DIST}-build-skip.log"
fromager \
--wheel-server-url $WHEEL_SERVER_URL \
--log-file "$log" \
--work-dir "$OUTDIR/work-dir" \
--sdists-repo "$OUTDIR/sdists-repo" \
Expand All @@ -103,7 +90,6 @@ $pass
export FROMAGER_BUILD_SEQUENCE_SKIP_EXISTING=true
log="$OUTDIR/build-logs/${DIST}-build-skip-env.log"
fromager \
--wheel-server-url $WHEEL_SERVER_URL \
--log-file "$log" \
--work-dir "$OUTDIR/work-dir" \
--sdists-repo "$OUTDIR/sdists-repo" \
Expand All @@ -127,7 +113,6 @@ $pass
# bootstrap stevedore with 2 changelog.
log="$OUTDIR/build-logs/${DIST}-build-changelog.log"
fromager \
--wheel-server-url $WHEEL_SERVER_URL \
--log-file "$log" \
--work-dir "$OUTDIR/work-dir" \
--sdists-repo "$OUTDIR/sdists-repo" \
Expand Down
6 changes: 2 additions & 4 deletions e2e/test_build_steps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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/"
Expand Down
3 changes: 1 addition & 2 deletions e2e/test_pep517_build_sdist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 7 additions & 10 deletions e2e/test_prebuilt_wheels_alt_server.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
# -*- indent-tabs-mode: nil; tab-width: 2; sh-indentation: 2; -*-

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

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

start_local_wheel_server "$INIT/wheels-repo"

# Modify the wheel so we can identify it as coming from the right
# server.
cd "$OUTDIR"
Expand All @@ -36,9 +34,6 @@ rm "$filename"
zip -r "$filename" flit_core*
cp "$filename" "$INIT/wheels-repo/downloads"

# Make sure the mirror is up to date
pypi-mirror create -d "$INIT/wheels-repo/downloads/" -m "$INIT/wheels-repo/simple/"

TESTDIR="$OUTDIR/test"
mkdir -p "$TESTDIR"
cd "$TESTDIR"
Expand All @@ -54,8 +49,10 @@ EOF
# the local server.
fromager \
-v \
--wheel-server-url "$WHEEL_SERVER_URL" \
--settings-dir="$TESTDIR/overrides/settings" \
--sdists-repo="$INIT/sdists-repo" \
--wheels-repo="$INIT/wheels-repo" \
--work-dir="$INIT/work-dir" \
bootstrap "${DIST}==${VERSION}" "wheel==0.43.0"

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

pass=true
for f in $EXPECTED_FILES; do
if [ ! -f "$f" ]; then
echo "FAIL: Did not find $OUTDIR/$f" 1>&2
if [ ! -f "$INIT/$f" ]; then
echo "FAIL: Did not find $INIT/$f" 1>&2
pass=false
fi
done

# Ensure we got the right copy of the wheel for flit_core, with the
# modified license file.
cd wheels-repo/prebuilt
cd $INIT/wheels-repo/prebuilt
unzip "$filename"
cat flit_core*.dist-info/LICENSE
if ! grep -q "Test was here" flit_core*.dist-info/LICENSE; then
Expand Down
3 changes: 1 addition & 2 deletions e2e/test_report_missing_dependency.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions src/fromager/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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()

Expand All @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions src/fromager/commands/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(
Expand Down
17 changes: 17 additions & 0 deletions src/fromager/commands/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand All @@ -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:
Expand All @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions src/fromager/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions tests/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 0e94970

Please sign in to comment.