Skip to content

Commit

Permalink
全て Ruff にする
Browse files Browse the repository at this point in the history
  • Loading branch information
voluntas committed Jan 23, 2024
1 parent 4619d76 commit 855a787
Show file tree
Hide file tree
Showing 5 changed files with 350 additions and 307 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

## develop

- [CHANGE] フォーマッターを Ruff に変更する
- @voluntas
- [UPDATE] nanobind を 1.8.0 に上げる
- @voluntas
- [UPDATE] actions/setup-python@v5 に上げる
Expand Down
21 changes: 16 additions & 5 deletions pypath.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ def get_python_include_dir(python_version: str):

# if Python.h not found (or python_include_dir is None), try to find a
# suitable include dir
found_python_h = python_include_dir is not None and os.path.exists(os.path.join(python_include_dir, "Python.h"))
found_python_h = python_include_dir is not None and os.path.exists(
os.path.join(python_include_dir, "Python.h")
)

if not found_python_h:
# NOTE(opadron): these possible prefixes must be guarded against
Expand Down Expand Up @@ -92,7 +94,14 @@ def get_python_include_dir(python_version: str):
if python_inc is not None:
python_inc2 = os.path.join(python_inc, ".".join(map(str, sys.version_info[:2])))

all_candidate_prefixes = [include_py, include_dir, include, plat_include, python_inc, python_inc2]
all_candidate_prefixes = [
include_py,
include_dir,
include,
plat_include,
python_inc,
python_inc2,
]
candidate_prefixes: list[str] = [pre for pre in all_candidate_prefixes if pre]

candidate_versions: tuple[str, ...] = (python_version,)
Expand Down Expand Up @@ -163,7 +172,7 @@ def get_python_library(python_version: str):
masd = sysconfig.get_config_var("multiarchsubdir")
if masd:
if masd.startswith(os.sep):
masd = masd[len(os.sep):]
masd = masd[len(os.sep) :]
libdir_masd = os.path.join(libdir, masd)
if os.path.exists(libdir_masd):
libdir = libdir_masd
Expand Down Expand Up @@ -218,7 +227,9 @@ def _guess_python_library(python_version: str):
assert not isinstance(libdir_a, int)
if libdir_a is None:
libdest = sysconfig.get_config_var("LIBDEST")
candidate_libdirs.append(os.path.abspath(os.path.join(libdest, "..", "libs") if libdest else "libs"))
candidate_libdirs.append(
os.path.abspath(os.path.join(libdest, "..", "libs") if libdest else "libs")
)
libdir_b = sysconfig.get_config_var("LIBDIR")
for libdir in (libdir_a, libdir_b):
if libdir is None:
Expand All @@ -227,7 +238,7 @@ def _guess_python_library(python_version: str):
masd = sysconfig.get_config_var("multiarchsubdir")
if masd:
if masd.startswith(os.sep):
masd = masd[len(os.sep):]
masd = masd[len(os.sep) :]
candidate_libdirs.append(os.path.join(libdir, masd))
candidate_libdirs.append(libdir)

Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,4 @@ dev-dependencies = [

[tool.ruff]
line-length = 100
indent-width = 4

exclude = [".venv", "run.py", "pypath.py", "setup.py"]
indent-width = 4
Loading

0 comments on commit 855a787

Please sign in to comment.