mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-06 05:21:22 +03:00
CI - Python deprecations (#9242)
py3.13 - https://docs.python.org/3/library/re.html#re.sub > Deprecated since version 3.13: Passing count and flags as positional arguments is deprecated. In future Python versions they will be keyword-only parameters. py3.12 - 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.
This commit is contained in:
parent
8e2094eb08
commit
606324ccf8
@ -1877,7 +1877,7 @@ def package ():
|
|||||||
substitution += ',\n'.join(board_items)
|
substitution += ',\n'.join(board_items)
|
||||||
substitution += '\n ],'
|
substitution += '\n ],'
|
||||||
|
|
||||||
newfilestr = re.sub(r'"boards":[^\]]*\],', substitution, filestr, re.MULTILINE)
|
newfilestr = re.sub(r'"boards":[^\]]*\],', substitution, filestr, flags=re.MULTILINE)
|
||||||
|
|
||||||
# To get consistent indent/formatting read the JSON and write it out programmatically
|
# To get consistent indent/formatting read the JSON and write it out programmatically
|
||||||
if packagegen:
|
if packagegen:
|
||||||
|
16
tools/get.py
16
tools/get.py
@ -18,11 +18,12 @@ import re
|
|||||||
|
|
||||||
verbose = True
|
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:
|
else:
|
||||||
# Not Python 3 - today, it is most likely to be Python 2
|
TARFILE_EXTRACT_ARGS = {}
|
||||||
from urllib import urlretrieve
|
|
||||||
|
|
||||||
dist_dir = 'dist/'
|
dist_dir = 'dist/'
|
||||||
|
|
||||||
@ -51,9 +52,10 @@ def report_progress(count, blockSize, totalSize):
|
|||||||
def unpack(filename, destination):
|
def unpack(filename, destination):
|
||||||
dirname = ''
|
dirname = ''
|
||||||
print('Extracting {0}'.format(filename))
|
print('Extracting {0}'.format(filename))
|
||||||
if filename.endswith('tar.gz'):
|
extension = filename.split('.')[-1]
|
||||||
tfile = tarfile.open(filename, 'r:gz')
|
if filename.endswith((f'.tar.{extension}', f'.t{extension}')):
|
||||||
tfile.extractall(destination)
|
tfile = tarfile.open(filename, f'r:{extension}')
|
||||||
|
tfile.extractall(destination, **TARFILE_EXTRACT_ARGS)
|
||||||
dirname= tfile.getnames()[0]
|
dirname= tfile.getnames()[0]
|
||||||
elif filename.endswith('zip'):
|
elif filename.endswith('zip'):
|
||||||
zfile = zipfile.ZipFile(filename)
|
zfile = zipfile.ZipFile(filename)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user