Skip to content

Commit

Permalink
Merge pull request #3104 from pygame-community/ankith26-whitespace-fixer
Browse files Browse the repository at this point in the history
Fix whitespace and eof formatting with pre-commit
  • Loading branch information
zoldalma999 authored Sep 24, 2024
2 parents c0ffea2 + 64c50db commit c0d17a4
Show file tree
Hide file tree
Showing 106 changed files with 617 additions and 635 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/blank_issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: 🗎 Blank Issue
about: A blank issue. For those who know what they are doing.
title: ''
labels:
labels:
assignees: ''

---
---
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ assignees: ''

**Environment:**

If possible, please include the output of `pygame.print_debug_info()` from your program in your bug report. It looks something
If possible, please include the output of `pygame.print_debug_info()` from your program in your bug report. It looks something
like this:

```
Expand All @@ -33,7 +33,7 @@ Freetype versions: Linked: 2.11.1 Compiled: 2.11.1
Display Driver: windows
Mixer Driver: wasapi
```
If you can't get the debug output, any of the environment details included in it that you do know would be useful
If you can't get the debug output, any of the environment details included in it that you do know would be useful
in diagnosing the issue & helping you.

Other environment details, not included in `print_debug_info()`, that might help:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/enhancement.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ assignees: ''

**Description**

Describe your enhancement, as clearly as possible.
Describe your enhancement, as clearly as possible.
2 changes: 1 addition & 1 deletion .github/workflows/build-debian-multiarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
export SDL_VIDEODRIVER=dummy
export SDL_AUDIODRIVER=disk
python3 -m pygame.tests -v --exclude opengl,music,timing --time_out 300
# Upload the generated files under github actions assets section
- name: Upload dist
uses: actions/upload-artifact@v4
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: macOS

# Run CI only when a release is created, on changes to main branch, or any PR
# to main. Do not run CI on any other branch. Also, skip any non-source changes
# Run CI only when a release is created, on changes to main branch, or any PR
# to main. Do not run CI on any other branch. Also, skip any non-source changes
# from running on CI
on:
push:
Expand All @@ -27,7 +27,7 @@ on:
- '.github/workflows/*.yml'
# re-include current file to not be excluded
- '!.github/workflows/build-macos.yml'

# the github release drafter can call this workflow
workflow_call:

Expand All @@ -54,7 +54,7 @@ jobs:
uses: actions/[email protected]
with:
path: ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }}
# The hash of all files in buildconfig manylinux-build and macdependencies is
# The hash of all files in buildconfig manylinux-build and macdependencies is
# the key to the cache. If anything changes here, the deps are built again
key: macdep-${{ hashFiles('buildconfig/manylinux-build/**') }}-${{ hashFiles('buildconfig/macdependencies/*.sh') }}-${{ matrix.macarch }}-${{ matrix.os }}
lookup-only: true
Expand Down Expand Up @@ -145,4 +145,3 @@ jobs:
name: pygame-wheels-macos-${{ matrix.macarch }}
path: ./wheelhouse/*.whl
compression-level: 0 # wheels are already zip files, no need for more compression

13 changes: 6 additions & 7 deletions .github/workflows/build-manylinux.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: ManyLinux

# Run CI only when a release is created, on changes to main branch, or any PR
# to main. Do not run CI on any other branch. Also, skip any non-source changes
# Run CI only when a release is created, on changes to main branch, or any PR
# to main. Do not run CI on any other branch. Also, skip any non-source changes
# from running on CI
on:
push:
Expand All @@ -27,7 +27,7 @@ on:
- '.github/workflows/*.yml'
# re-include current file to not be excluded
- '!.github/workflows/build-manylinux.yml'

# the github release drafter can call this workflow
workflow_call:

Expand All @@ -42,12 +42,12 @@ jobs:
permissions:
contents: read
packages: write

strategy:
fail-fast: false # if a particular matrix build fails, don't skip the rest
matrix:
arch: [x86_64, i686]

env:
CIBW_ARCHS: ${{ matrix.arch }}

Expand All @@ -60,7 +60,7 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Inspect image, skip build if image exists
id: inspect
continue-on-error: true
Expand Down Expand Up @@ -100,4 +100,3 @@ jobs:
name: pygame-wheels-manylinux-${{ matrix.arch }}
path: ./wheelhouse/*.whl
compression-level: 0 # wheels are already zip files, no need for more compression

11 changes: 5 additions & 6 deletions .github/workflows/build-ubuntu-sdist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

name: Ubuntu sdist

# Run CI only when a release is created, on changes to main branch, or any PR
# to main. Do not run CI on any other branch. Also, skip any non-source changes
# Run CI only when a release is created, on changes to main branch, or any PR
# to main. Do not run CI on any other branch. Also, skip any non-source changes
# from running on CI
on:
push:
Expand All @@ -34,7 +34,7 @@ on:
- '.github/workflows/*.yml'
# re-include current file to not be excluded
- '!.github/workflows/build-ubuntu-sdist.yml'

# the github release drafter can call this workflow
workflow_call:

Expand All @@ -44,7 +44,7 @@ concurrency:

jobs:
build:
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # if a particular matrix build fails, don't skip the rest
matrix:
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
SDL_VIDEODRIVER: "dummy"
SDL_AUDIODRIVER: "disk"
run: python3 -m pygame.tests -v --exclude opengl,music,timing --time_out 300

- name: Test typestubs
if: matrix.os == 'ubuntu-22.04' # run stubtest only once
run: |
Expand All @@ -89,4 +89,3 @@ jobs:
name: pygame-wheels-sdist
path: dist/*.tar.gz
compression-level: 0 # already compressed, no need for more compression

2 changes: 1 addition & 1 deletion .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ on:
- '.github/workflows/*.yml'
# re-include current file to not be excluded
- '!.github/workflows/build-windows.yml'

# the github release drafter can call this workflow
workflow_call:

Expand Down
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@
# Then in the project root directory run `pre-commit install`

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: end-of-file-fixer
exclude: |
(?x)^(
^docs/licenses/.*$
| ^.*\.svg$
| ^.*\.sfd$
| docs/LGPL.txt
)$
- id: trailing-whitespace
exclude: |
(?x)^(
^docs/licenses/.*$
| ^.*\.svg$
| ^.*\.sfd$
| docs/LGPL.txt
)$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.2
hooks: # See pyproject.toml for configuration options.
Expand Down
2 changes: 0 additions & 2 deletions buildconfig/Setup.Emscripten.SDL2.in
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,3 @@ _sdl2.touch src_c/void.c

#transform src_c/simd_transform_sse2.c src_c/simd_transform_avx2.c src_c/transform.c src_c/rotozoom.c src_c/scale2x.c src_c/scale_mmx.c src_c/simd_surface_fill_avx2.c src_c/simd_surface_fill_sse2.c $(SDL) $(DEBUG) -D_NO_MMX_FOR_X86_64
transform src_c/void.c


2 changes: 1 addition & 1 deletion buildconfig/ci/circleci/pull_circleci_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
A script to automate downloading CircleCI artifacts.
Usage: python3 pull_circleci_artifacts.py <TOKEN> <PIPELINE_ID> <SAVE_DIR>
TOKEN:
TOKEN:
CircleCI "personal access token" of a github (preferably machine) user.
This is secret!
Expand Down
1 change: 0 additions & 1 deletion buildconfig/config_emsdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,4 +267,3 @@ def main(auto_config=False):
if __name__ == "__main__":
print("This is the configuration subscript for Emscripten.")
print('Please run "config.py" for full configuration.')

2 changes: 1 addition & 1 deletion buildconfig/config_unix.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def main(auto_config=False):
origincdirs = ['/include', '/include/SDL2']
origlibdirs = ['/lib', '/lib64', '/X11R6/lib']

# If we are on a debian based system, we also need to handle
# If we are on a debian based system, we also need to handle
# /lib/<multiarch-tuple>
# We have a few commands to get the correct <multiarch-tuple>, we try those
# one by one till we get something that works
Expand Down
2 changes: 1 addition & 1 deletion buildconfig/config_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def _add_sdl2_dll_deps(DEPS):
DEPS.add_dll(r'(z|zlib1)\.dll$', 'z', ['zlib-[1-9].*'])
DEPS.add_dll(r'(lib)?webp[-0-9]*\.dll$', 'webp', ['*webp-[0-9]*'])
DEPS.add_dll(r'(lib)?webpdemux[-0-9]*\.dll$', 'webpdemux', ['*webpdemux-[0-9]*'])


def setup():
DEPS = DependencyGroup()
Expand Down
1 change: 0 additions & 1 deletion buildconfig/macdependencies/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ fi
It currently relies on GNU `readlink` to build, which is provided
by the coreutils homebrew package. However, this could be fixed to be
cross platform, since mac `readlink` does not support `-f`.

2 changes: 1 addition & 1 deletion buildconfig/manylinux-build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ push-manylinux2014-x86:

push-manylinux2014-aarch64:
docker push pygame/manylinux2014_base_aarch64

# push: push-manylinux1-x64 push-manylinux1-x86 push-manylinux2010-x64 push-manylinux2010-x86 push-manylinux2014-x64 push-manylinux2014-x86
push: push-manylinux2010-x64 push-manylinux2010-x86 push-manylinux2014-x64 push-manylinux2014-x86 push-manylinux2014-aarch64

Expand Down
1 change: 0 additions & 1 deletion buildconfig/manylinux-build/docker_base/Dockerfile-aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,3 @@ RUN ["bash", "/portmidi_build/build-portmidi.sh"]
# run strip on built libraries
COPY strip-lib-so-files.sh /tmp/
RUN source /tmp/strip-lib-so-files.sh

2 changes: 1 addition & 1 deletion buildconfig/manylinux-build/docker_base/alsa/build-alsa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ tar xjf ${ALSA}.tar.bz2
cd ${ALSA}

# alsa prefers /usr prefix as a default, so we explicitly override it
./configure $PG_BASE_CONFIGURE_FLAGS --with-configdir=$PG_DEP_PREFIX/share/alsa
./configure $PG_BASE_CONFIGURE_FLAGS --with-configdir=$PG_DEP_PREFIX/share/alsa
make
make install
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e -x
cd $(dirname `readlink -f "$0"`)

# This file installs tools (cmake and meson+ninja) needed to build dependencies
# Also installs setuptools to make sure distutils is available (on newer python
# Also installs setuptools to make sure distutils is available (on newer python
# versions) because some builds may need it.
# cmake is also installed via pip because it is easier than maintaining a
# separate build script for it
Expand Down
1 change: 0 additions & 1 deletion buildconfig/manylinux-build/docker_base/glib/build-glib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ meson setup _build $PG_BASE_MESON_FLAGS --force-fallback-for libpcre2-8 -Dtests=

meson compile -C _build
meson install -C _build

Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ cd ${MODPLUG_NAME}
./configure $PG_BASE_CONFIGURE_FLAGS
make
make install

Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ cd $PNG
./configure --with-zlib-prefix=$PG_DEP_PREFIX $PG_BASE_CONFIGURE_FLAGS
make
make install

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e -x

cd $(dirname `readlink -f "$0"`)

# We need mesa for opengl, gbm (SDL kmsdrm driver needs it), egl (SDL
# We need mesa for opengl, gbm (SDL kmsdrm driver needs it), egl (SDL
# wayland driver needs this) and glx (SDL needs it)
# we don't support vulkan yet

Expand All @@ -21,7 +21,7 @@ cd $MESA
if [ `uname -m` == "aarch64" ]; then
# On aarch64 we allow mesa to use all drivers it wants to pick by default
# (because radeonsi is not used on arm platforms)
GALLIUM_DRIVERS="auto"
GALLIUM_DRIVERS="auto"
else
# all default except radeonsi
GALLIUM_DRIVERS="r300,r600,nouveau,virgl,svga,swrast,iris,crocus,i915"
Expand Down
1 change: 0 additions & 1 deletion buildconfig/manylinux-build/docker_base/ogg/build-ogg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ elif [[ "$OSTYPE" == "darwin"* ]]; then
fi
make
make install

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# This file exists because pkg-config is too old on manylinux docker centos
# This file exists because pkg-config is too old on manylinux docker centos
# images (the older version segfaults if it gets a cyclic dependency, like
# freetype2+harfbuzz)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,3 @@ cd $MIX2

make
make install

Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ cd $SNDNAME
./configure $PG_BASE_CONFIGURE_FLAGS --disable-mpeg --disable-alsa
make
make install

Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ cd ${ZLIB_NG_NAME}
cmake . $PG_BASE_CMAKE_FLAGS -DZLIB_COMPAT=1
make
make install

1 change: 0 additions & 1 deletion buildconfig/manylinux-build/docker_base/zlib/build-zlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ cd ${ZLIB_NAME}
./configure $PG_BASE_CONFIGURE_FLAGS
make
make install

4 changes: 2 additions & 2 deletions buildconfig/stubs/gen_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"window": ["Window"],
"base": ["__version__"], # need an explicit import
# uncomment below line if Circle is added to the base namespace later
# "geometry": ["Circle"],
# "geometry": ["Circle"],
}

# pygame modules from which __init__.py does the equivalent of
Expand Down Expand Up @@ -153,7 +153,7 @@ def get_all(mod: Any):
for element in get_all(pygame.locals):
constant_type = getattr(pygame.locals, element).__class__.__name__
f.write(f"{element}: {constant_type}\n")

# copy typing.py to typing.pyi for type checkers
typing_py_file = pathlib.Path(__file__).parent.parent.parent / "src_py" / "typing.py"
typing_stub_file = pathlib.Path(__file__).parent / "pygame" / "typing.pyi"
Expand Down
2 changes: 1 addition & 1 deletion buildconfig/stubs/mypy_allow_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# cython files have this top level dunder
pygame\._sdl2\..*\.__test__

# cython classes have some special dunders for internal use, ignore that in
# cython classes have some special dunders for internal use, ignore that in
# stubtest
pygame\._sdl2\..*\.__pyx_.*__

Expand Down
2 changes: 1 addition & 1 deletion buildconfig/stubs/pygame/rect.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class _GenericRect(Collection[_N]):
# Sized, Iterable and Container ABCs
class Rect(_GenericRect[int]):
...

class FRect(_GenericRect[float]):
...

Expand Down
2 changes: 1 addition & 1 deletion buildconfig/stubs/pygame/sprite.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class Group(AbstractGroup[_TSprite]):
def __init__(
self, *sprites: Union[_TSprite, AbstractGroup[_TSprite], Iterable[_TSprite]]
) -> None: ...

# these are aliased in the code too
@deprecated("Use `pygame.sprite.Group` instead")
class RenderPlain(Group): ...
Expand Down
Loading

0 comments on commit c0d17a4

Please sign in to comment.