Skip to content

CI: Improved check for gamefix filenames #126

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

Merged
merged 3 commits into from
Sep 10, 2024
Merged
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
13 changes: 10 additions & 3 deletions .github/scripts/check_gamefixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,20 +183,27 @@ def check_filenames(root: Path) -> None:
"""Check for expected file names.

All files in non-steam gamefixes are expected to start with 'umu-'
All files in steam gamefixes are expected to have a numeric name
"""
gamefixes = [
file
for file in root.glob('gamefixes-*/*.py')
if not file.name.startswith(('__init__.py', 'default.py', 'winetricks-gui.py'))
and not file.parent.name.startswith('gamefixes-steam')
]

print('Checking for expected file names...', file=sys.stderr)
for module in gamefixes:
print(f'{module.parent.name}/{module.name}', file=sys.stderr)
if module.exists() and not module.name.startswith('umu-'):
err = f'The following file does not start with "umu-": {module}'
is_steam = module.parent.name.startswith('gamefixes-steam')
if not module.exists():
err = f'The following file does not exist: {module.parent.name}/{module}'
raise FileNotFoundError(err)
elif is_steam and not module.stem.isnumeric():
err = f'The following Steam fix filename is invalid: {module}'
raise ValueError(err)
elif not is_steam and not module.name.startswith('umu-'):
err = f'The following file does not start with "umu-": {module}'
raise ValueError(err)


def main() -> None:
Expand Down