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

chore: fix ruff configuration #186

Merged
merged 1 commit into from
Feb 1, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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