From 2ece7cebfc0a59a3db2013406b8ca023d3d296fe Mon Sep 17 00:00:00 2001 From: Alexandre Detiste Date: Sun, 15 Sep 2024 14:18:06 +0200 Subject: [PATCH] remove usage of old Random2 backport --- .appveyor.yml | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/macos-package.yml | 2 +- .travis.yml | 2 +- README.md | 6 ++---- buildozer/buildozer.spec | 2 +- contrib/install-pysolfc.sh | 2 +- pysollib/game/__init__.py | 5 ++--- setup.py | 4 +++- 9 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index c7a6eed67f..d160112691 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -10,7 +10,7 @@ install: - copy %PYTHON%\python.exe %PYTHON%\python3.exe - SET PATH=%PYTHON%;%PYTHON%\Scripts;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;%PATH% - python3 -mpip install Pillow attrs configobj flake8 flake8-import-order - pycotap pygame pyinstaller pysol-cards random2 setuptools six + pycotap pygame pyinstaller pysol-cards setuptools six ttkthemes - perl -v - copy C:\msys64\mingw64\bin\mingw32-make.exe C:\msys64\mingw64\bin\make.exe diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9de12aa2b5..bb67b4d76b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install flake8 flake8-import-order \ - attrs configobj pycotap pysol-cards random2 setuptools six + attrs configobj pycotap pysol-cards setuptools six if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Lint with flake8 run: | diff --git a/.github/workflows/macos-package.yml b/.github/workflows/macos-package.yml index 9ea509454d..057c06504c 100644 --- a/.github/workflows/macos-package.yml +++ b/.github/workflows/macos-package.yml @@ -23,7 +23,7 @@ jobs: run: | python3 -m pip install --upgrade pip python3 -m pip install --no-binary=Pillow \ - Pillow attrs configobj py2app pycotap pygame pysol-cards random2 setuptools six ttkthemes + Pillow attrs configobj py2app pycotap pygame pysol-cards setuptools six ttkthemes if [ -f requirements.txt ]; then pip install -r requirements.txt; fi brew install create-dmg - name: Get cardsets diff --git a/.travis.yml b/.travis.yml index 376896c1fe..edf4a1db90 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,7 +46,7 @@ install: # Tests are failing for them sometimes - cpanm --notest Capture::Tiny IPC::System::Simple - cpanm Code::TidyAll::Plugin::Flake8 Perl::Tidy Test::Code::TidyAll Test::Differences Test::TrailingSpace - - export PY_MODS='attrs configobj pycotap pysol-cards random2 setuptools six' + - export PY_MODS='attrs configobj pycotap pysol-cards setuptools six' - if test "$TRAVIS_OS_NAME" = "osx" ; then export PY_MODS="--no-binary=Pillow Pillow $PY_MODS" ; fi - sudo -H pip3 install --upgrade wheel - sudo -H pip3 install --upgrade $PY_MODS flake8 flake8-import-order diff --git a/README.md b/README.md index a52e481f03..e1371565ad 100644 --- a/README.md +++ b/README.md @@ -118,21 +118,19 @@ per the instructions above. At the moment, this only works on POSIX (Linux, FreeBSD and similar) systems. Windows and Mac users - you'll need to chip in with a script for your system. -#### 1 - Install build prerequisites: six, random2 and pysol-cards +#### 1 - Install build prerequisites: six and pysol-cards This is kind of stupid and maybe it can be fixed in the future, but for now: ``` pip install six -pip install random2 pip install pysol-cards ``` You may want to use your OS distribution package system instead, for example: ``` -sudo apt-get install python-six -sudo apt-get install python-random2 +sudo apt-get install python3-six ``` For Pillow compilation, libjpeg headers and libraries need to be available: diff --git a/buildozer/buildozer.spec b/buildozer/buildozer.spec index 43e884a268..ac0c7eb6c4 100644 --- a/buildozer/buildozer.spec +++ b/buildozer/buildozer.spec @@ -38,7 +38,7 @@ version.filename = %(source.dir)s/version.txt # (list) Application requirements # comma separated e.g. requirements = sqlite3,kivy -requirements = python3,kivy,pysol-cards,random2,configobj,attrs +requirements = python3,kivy,pysol-cards,configobj,attrs # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/contrib/install-pysolfc.sh b/contrib/install-pysolfc.sh index 245269e45f..96a34c2793 100755 --- a/contrib/install-pysolfc.sh +++ b/contrib/install-pysolfc.sh @@ -6,7 +6,7 @@ PIP="${PKGTREE}/env/bin/pip" PYPROG="${PKGTREE}/env/bin/python" VERSION="$(env PYTHONPATH=`pwd` "$PYPROG" -c 'from pysollib.settings import VERSION ; print(VERSION)')" XZBALL="dist/PySolFC-${VERSION}.tar.xz" -reqs=(pillow pygame random2 six) +reqs=(pillow pygame six) make dist diff --git a/pysollib/game/__init__.py b/pysollib/game/__init__.py index 40fedfc2bd..b41d7cc4d4 100644 --- a/pysollib/game/__init__.py +++ b/pysollib/game/__init__.py @@ -23,6 +23,7 @@ import math +import random import time import traceback from pickle import Pickler, Unpickler, UnpicklingError @@ -67,8 +68,6 @@ from pysollib.settings import VERSION, VERSION_TUPLE from pysollib.struct_new import NewStruct -import random2 - import six from six import BytesIO from six.moves import range @@ -3363,7 +3362,7 @@ def validate(v, txt): game.random = construct_random(initial_seed) state = pload() if (game.random is not None and - not isinstance(game.random, random2.Random) and + not isinstance(game.random, random.Random) and isinstance(state, int)): game.random.setstate(state) # if not hasattr(game.random, "origin"): diff --git a/setup.py b/setup.py index 72354879a9..d46f4128be 100644 --- a/setup.py +++ b/setup.py @@ -71,11 +71,13 @@ def get_data_files(source, destination): 'author': 'Skomoroh', 'author_email': 'skomoroh@gmail.com', 'description': 'a Python solitaire game collection', + 'classifiers': [ + 'Programming Language :: Python :: 3', + ], 'install_requires': [ 'attrs>=18.2.0', 'configobj', 'pysol_cards', - 'random2', 'six', ], 'long_description': long_description,