Skip to content

Commit afa2c6b

Browse files
authored
Merge pull request #522 from JaskRendix/format
Add Makefile with ruff commands and apply `make fix` to codebase
2 parents 8541a5d + ca9eb06 commit afa2c6b

74 files changed

Lines changed: 7816 additions & 5238 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.PHONY: lint format fix
2+
3+
lint:
4+
ruff check .
5+
6+
format:
7+
ruff format .
8+
9+
fix:
10+
ruff check --fix .
11+
ruff format .

build.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,35 @@
1111
import sys
1212
from pathlib import Path
1313

14-
assert len(sys.argv) == 2, 'Argument is required, usage: build.py pip/twine'
14+
assert len(sys.argv) == 2, "Argument is required, usage: build.py pip/twine"
1515
mode: str = sys.argv[1].strip()
1616

1717
root = Path(__file__).resolve().parent
18-
dist = root / 'dist'
19-
build = root / 'build'
18+
dist = root / "dist"
19+
build = root / "build"
2020

21-
if mode == 'pip':
21+
if mode == "pip":
2222
if dist.is_dir():
2323
for k in dist.iterdir():
24-
if 'pygame_menu-' in k.name or 'pygame-menu-' in k.name:
24+
if "pygame_menu-" in k.name or "pygame-menu-" in k.name:
2525
k.unlink()
2626

2727
if build.is_dir():
2828
for k in build.iterdir():
29-
if 'bdist.' in k.name or k.name == 'lib':
29+
if "bdist." in k.name or k.name == "lib":
3030
shutil.rmtree(k)
3131

32-
subprocess.run(
33-
["python", "setup.py", "sdist", "bdist_wheel"],
34-
check=True
35-
)
32+
subprocess.run(["python", "setup.py", "sdist", "bdist_wheel"], check=True)
3633

37-
elif mode == 'twine':
34+
elif mode == "twine":
3835
if dist.is_dir():
3936
subprocess.run(
4037
["python", "-m", "twine", "upload", "dist/*"],
41-
shell=True, # required because of wildcard
42-
check=True
38+
shell=True, # required because of wildcard
39+
check=True,
4340
)
4441
else:
45-
raise FileNotFoundError('No distribution found, execute build.py pip first')
42+
raise FileNotFoundError("No distribution found, execute build.py pip first")
4643

4744
else:
48-
raise ValueError(f'Unknown mode {mode}')
45+
raise ValueError(f"Unknown mode {mode}")

0 commit comments

Comments
 (0)