pygame-community / pygame-ce

🐍🎮 pygame - Community Edition is a FOSS Python library for multimedia applications (like games). Built on top of the excellent SDL library.
https://pyga.me
773 stars 120 forks source link

setup.py: Properly add _sdl2_data_files to data_files #2770

Closed cclauss closed 3 months ago

cclauss commented 3 months ago

Currently, this code is ALWAYS adding an empty list instead of the data files that were found by glob.glob().

It adds the empty list before filling the list!

cclauss commented 3 months ago

TIL:

>>> big = []
>>> little = []
>>> big.append(("little", little))
>>> big
[('little', [])]
>>> for c in "abc":
...     little.append(c)
...
>>> little
['a', 'b', 'c']
>>> big
[('little', ['a', 'b', 'c'])]
cclauss commented 3 months ago

Once pre-commit is merged, we can add auto-walrus if you would like...

% auto-walrus **/*.py

Rewriting buildconfig/msysio.py
Rewriting src_py/sprite.py
Rewriting src_py/sysfont.py
Rewriting test/controller_test.py
Rewriting test/mask_test.py
Rewriting test/mixer_test.py
Rewriting test/test_utils/test_runner.py