Skip to content
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

Add support for Python 3.12 #2119

Merged
merged 8 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/build-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:

pip3 install -U pip setuptools wheel
pip3 install -r requirements.txt
diff -u0 <(sed -e 's,#.*,,' -e '/^$/d' < requirements.txt | sort -f) <(pip3 freeze | sort -f) # enforces complete pinning
diff -u0 <(sed -e 's,#.*,,' -e '/^$/d' < requirements.txt | sort -f) <(pip3 freeze | sed -e '/^setuptools==/d' -e '/^wheel==/d' | sort -f) # enforces complete pinning

time PYTHONPATH=lib python3 pgn2ecodb.py
time PYTHONPATH=lib python3 create_theme_preview.py
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/build-rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: Build RPM package for Linux
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', 3.11]
python-version: [3.8, 3.9, '3.10', 3.11, 3.12]
runs-on: ubuntu-22.04
env:
PYVER: ${{ matrix.python-version }}
Expand Down Expand Up @@ -70,8 +70,12 @@ jobs:
sudo ln -s python${PYVER} /usr/bin/python
sudo ln -s python${PYVER} /usr/bin/python3
sudo ln -s python${PYVER}-config /usr/bin/python3-config

sudo python3 -m ensurepip --upgrade
fi

sudo python3 -m pip install -U pip setuptools wheel

sed 's,:,\n,g' <<<"${PATH}"

which python
Expand All @@ -96,7 +100,7 @@ jobs:

pip3 install -U pip setuptools wheel
pip3 install -r requirements.txt
diff -u0 <(sed -e 's,#.*,,' -e '/^$/d' < requirements.txt | sort -f) <(pip3 freeze | sort -f) # enforces complete pinning
diff -u0 <(sed -e 's,#.*,,' -e '/^$/d' < requirements.txt | sort -f) <(pip3 freeze | sed -e '/^setuptools==/d' -e '/^wheel==/d' | sort -f) # enforces complete pinning

time PYTHONPATH=lib python3 pgn2ecodb.py
time PYTHONPATH=lib python3 create_theme_preview.py
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ jobs:
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: 3.11
python-version: 3.12
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
4 changes: 2 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: Run the test suite
strategy:
matrix:
python-version: [3.8, 3.11] # no particular need for in-between versions
python-version: [3.8, 3.12] # no particular need for in-between versions
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:

pip3 install -U pip setuptools wheel
pip3 install -r requirements.txt
diff -u0 <(sed -e 's,#.*,,' -e '/^$/d' < requirements.txt | sort -f) <(pip3 freeze | sort -f) # enforces complete pinning
diff -u0 <(sed -e 's,#.*,,' -e '/^$/d' < requirements.txt | sort -f) <(pip3 freeze | sed -e '/^setuptools==/d' -e '/^wheel==/d' | sort -f) # enforces complete pinning

time PYTHONPATH=lib python3 pgn2ecodb.py
time PYTHONPATH=lib python3 create_theme_preview.py
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.6.0
rev: v3.15.2
hooks:
- id: pyupgrade
args: ['--py38-plus']
Expand All @@ -13,7 +13,7 @@ repos:
exclude: 'doc/createDoc'

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 7.0.0
hooks:
- id: flake8
exclude: 'doc/createDoc'
4 changes: 4 additions & 0 deletions create_rpm_py312.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
export PYTHONUSERBASE=/usr
python3 setup.py bdist_rpm --python=/usr/bin/python3.12 --release=1.py312 --requires python3-sqlalchemy,python3-pexpect,python3-psutil,python3-websockets,python3-gobject,python3-cairo,gobject-introspection,glib2,gtk3,pango,gdk-pixbuf2,gtksourceview3,gstreamer1,gstreamer1-plugins-base,stockfish

2 changes: 1 addition & 1 deletion lib/pychess/widgets/BoardControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def play_or_add_move(self, board, move):
for i, vari in enumerate(board.board.next.children):
for node in vari:
if (
type(node) != str
not isinstance(node, str)
and node.lastMove == move.move
and node.plyCount == board.ply + 1
):
Expand Down
1 change: 0 additions & 1 deletion lib/pychess/widgets/gamenanny.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ def game_ended(self, gamemodel, reason, gmwidg):
content = InfoBar.get_message_content(msg_one, msg_two, Gtk.STOCK_DIALOG_INFO)
message = InfoBarMessage(Gtk.MessageType.INFO, content, None)

callback = None
if isinstance(gamemodel, ICGameModel):
if gamemodel.hasLocalPlayer() and not gamemodel.examined:

Expand Down
5 changes: 0 additions & 5 deletions pychess
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
import os
import sys

# Check Python version
if sys.version_info < (3, 8, 0):
print("ERROR: PyChess requires Python >= 3.8.0")
sys.exit(1)

# Fix environment to let pychess run in place
if getattr(sys, "frozen", False):
this_dir = os.path.dirname(sys.executable)
Expand Down
5 changes: 1 addition & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
else:
from setuptools import setup

if sys.version_info < (3, 8, 0):
print("ERROR: PyChess requires Python >= 3.8.0")
sys.exit(1)

if sys.platform == "win32":
try:
import gi
Expand Down Expand Up @@ -103,6 +99,7 @@
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Games/Entertainment :: Board Games",
]

Expand Down
Loading