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

Replace deprecated distutils package #1771

Merged

Conversation

ppigazzini
Copy link
Collaborator

The package distutils is deprecated since python 3.10 and it is scheduled to be removed with python 3.12, see: https://docs.python.org/3.12/whatsnew/3.12.html
python/cpython#92584

shutil.copytree() is able to copy the source directory tree to an existing destination directory only from python 3.8 (parameter dirs_exist_ok=True), for python < 3.8 still use distutils.dir_util.copy_tree()

While here:

  • create in a safe way the temporary directory used for the update
  • deal with possible download problems

Raise worker version to 214 (also server side)

@ppigazzini ppigazzini added enhancement worker update code changes requiring a worker update update code change to account external change (Stockfish, book etc.) labels Aug 28, 2023
The package `distutils` is deprecated since python 3.10
and it is scheduled to be removed with python 3.12, see:
https://docs.python.org/3.12/whatsnew/3.12.html
python/cpython#92584

`shutil.copytree()` is able to copy the source directory tree to an existing
destination directory only from python 3.8 (parameter `dirs_exist_ok=True`),
for python < 3.8 still use `distutils.dir_util.copy_tree()`

While here:
- create in a safe way the temporary directory used for the update
- deal with possible download problems

Raise worker version to 214 (also server side)
@ppigazzini ppigazzini force-pushed the deprecated_distutils branch from 622c1c7 to 5410bb0 Compare August 28, 2023 15:58
@ppigazzini
Copy link
Collaborator Author

ppigazzini commented Aug 28, 2023

With python 3.12.0rc1 master doesn't work:

$ python3 worker.py
Traceback (most recent call last):
  File "/home/usrft/fishtest/worker/worker.py", line 52, in <module>
    from updater import update
  File "/home/usrft/fishtest/worker/updater.py", line 5, in <module>
    from distutils.dir_util import copy_tree
ModuleNotFoundError: No module named 'distutils'

@ppigazzini
Copy link
Collaborator Author

PR tested working with linux worker (python: 3.6.8, 3.8.0, 3.11.5, 3.12.0rc1) and windows worker (python: 3.11.5).

@ppigazzini ppigazzini merged commit 87317f7 into official-stockfish:master Aug 28, 2023
@ppigazzini ppigazzini deleted the deprecated_distutils branch August 28, 2023 20:19
@ppigazzini
Copy link
Collaborator Author

Triggered the workers update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement update code change to account external change (Stockfish, book etc.) worker update code changes requiring a worker update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant