8000 CI - Python deprecations by mcspr · Pull Request #9242 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content

CI - Python deprecations #9242

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

Merged
merged 3 commits into from
May 20, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
get.py tarfile py3.12 extraction filter=...
https://docs.python.org/3/library/tarfile.html#tarfile.TarFile.extraction_filter
> If extraction_filter is None (the default), calling an extraction method without a filter argument
> will raise a DeprecationWarning, and fall back to the fully_trusted filter, whose dangerous
> behavior matches previous versions of Python.
  • Loading branch information
mcspr committed May 20, 2025
commit 6b2e1932e360faf89b6f4865ecf15a12b6a48263
16 changes: 9 additions & 7 deletions tools/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@

verbose = True

if sys.version_info[0] == 3:
from urllib.request import urlretrieve
from urllib.request import urlretrieve

if sys.version_info >= (3,12):
TARFILE_EXTRACT_ARGS = {'filter': 'data'}
else:
# Not Python 3 - today, it is most likely to be Python 2
from urllib import urlretrieve
TARFILE_EXTRACT_ARGS = {}

dist_dir = 'dist/'

Expand Down Expand Up @@ -51,9 +52,10 @@ def report_progress(count, blockSize, totalSize):
def unpack(filename, destination):
dirname = ''
print('Extracting {0}'.format(filename))
if filename.endswith('tar.gz'):
tfile = tarfile.open(filename, 'r:gz')
tfile.extractall(destination)
extension = filename.split('.')[-1]
if filename.endswith((f'.tar.{extension}', f'.t{extension}')):
tfile = tarfile.open(filename, f'r:{extension}')
tfile.extractall(destination, **TARFILE_EXTRACT_ARGS)
dirname= tfile.getnames()[0]
elif filename.endswith('zip'):
zfile = zipfile.ZipFile(filename)
Expand Down
Loading
0