Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of skip-if-exists #20

Merged
merged 1 commit into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ The optional `ensured-targets` is a list of expected file paths after building a
"standard" version sdist or wheel.

The optional `skip-if-exists` is a list of paths whose presence would cause
the build step to be skipped.
the build step to be skipped. This option is ignored in `editable` mode.
The `ensured-targets` will still be checked, if given.

The optional `build-kwargs` is a set of keyword arguments to pass to the build
function.
Expand Down
21 changes: 11 additions & 10 deletions hatch_jupyter_builder/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,21 @@ def initialize(self, version, build_data):
ensured_targets = self.config.get("ensured-targets", [])
skip_if_exists = self.config.get("skip-if-exists", [])

if version == "editable":
build_kwargs = editable_build_kwargs or build_kwargs

should_skip_build = False
if not build_function:
return
should_skip_build = True

if skip_if_exists:
return should_skip(skip_if_exists)
elif skip_if_exists and version == "standard":
should_skip_build = should_skip(skip_if_exists)

# Get build function and call it with normalized parameter names.
build_func = get_build_func(build_function)

if version == "editable":
build_kwargs = editable_build_kwargs or build_kwargs

build_kwargs = normalize_kwargs(build_kwargs)
build_func(self.target_name, version, **build_kwargs)
if not should_skip_build:
build_func = get_build_func(build_function)
build_kwargs = normalize_kwargs(build_kwargs)
build_func(self.target_name, version, **build_kwargs)

# Ensure targets in distributable dists.
if version == "standard":
Expand Down