Skip to content

Commit

Permalink
Correcting format
Browse files Browse the repository at this point in the history
In my haste to submit a pull-request I neglected to check format. Apologies.
  • Loading branch information
bhrollins authored Aug 4, 2022
1 parent e77b1d7 commit 3ff682e
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions maturin/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,39 @@
import sysconfig
from typing import Optional


def get_maturin_path() -> Optional[Path]:
SCRIPT_NAME = "maturin"

def script_dir(scheme: str) -> Path:
return sysconfig.get_path("scripts", scheme)

def script_exists(dir: Path) -> bool:
for _, _, files in os.walk(dir):
for f in files:
name, *_ = os.path.splitext(f)
if name == SCRIPT_NAME:
return True

return False


paths = list(filter(script_exists,
filter(os.path.exists,
map(script_dir, sysconfig.get_scheme_names()))))

paths = list(
filter(
script_exists,
filter(os.path.exists, map(script_dir, sysconfig.get_scheme_names())),
)
)

if paths:
return Path(paths[0]) / SCRIPT_NAME

return None


if __name__ == "__main__":
maturin = get_maturin_path()
if maturin is None:
print('Unable to find `maturin` script')
print("Unable to find `maturin` script")
exit(1)

os.execv(maturin, [str(maturin)] + sys.argv[1:])

0 comments on commit 3ff682e

Please sign in to comment.