Skip to content

Commit

Permalink
chore: fix ruff configuration (#186)
Browse files Browse the repository at this point in the history
Some of our files are being skipped because they have "build" in the
name. Noticed this in pypa/build#573, and turns
out problems were being masked here too.

Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii authored Feb 1, 2023
1 parent 6003ca5 commit 4003a83
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ target-version = "py37"
typing-modules = ["scikit_build_core._compat.typing"]
src = ["src"]
unfixable = ["T20"]
exclude = []

[tool.ruff.per-file-ignores]
"tests/**" = ["T20"]
Expand Down
5 changes: 2 additions & 3 deletions src/scikit_build_core/build/_file_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ def each_unignored_file(
Runs through all non-ignored files. Must be run from the root directory.
"""
exclude_lines = EXCLUDE_LINES + list(exclude)
with contextlib.suppress(FileNotFoundError), open(
".gitignore", encoding="utf-8"
) as f:
gi = Path(".gitignore")
with contextlib.suppress(FileNotFoundError), gi.open(encoding="utf-8") as f:
exclude_lines += f.readlines()

exclude_spec = pathspec.GitIgnoreSpec.from_lines(exclude_lines)
Expand Down
11 changes: 6 additions & 5 deletions src/scikit_build_core/build/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,15 @@ def build_wheel(
d.mkdir(parents=True)

if ".." in settings.wheel.install_dir:
raise AssertionError("wheel.install_dir must not contain '..'")
msg = "wheel.install_dir must not contain '..'"
raise AssertionError(msg)
if settings.wheel.install_dir.startswith("/"):
if not settings.experimental:
raise AssertionError(
"Experimental features must be enabled to use absolute paths in wheel.install_dir"
)
msg = "Experimental features must be enabled to use absolute paths in wheel.install_dir"
raise AssertionError(msg)
if settings.wheel.install_dir[1:].split("/")[0] not in wheel_dirs:
raise AssertionError("Must target a valid wheel directory")
msg = "Must target a valid wheel directory"
raise AssertionError(msg)
install_dir = wheel_dir / settings.wheel.install_dir[1:]
else:
install_dir = wheel_dirs["platlib"] / settings.wheel.install_dir
Expand Down

0 comments on commit 4003a83

Please sign in to comment.