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
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 tools/boards.txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1877,7 +1877,7 @@ def package ():
substitution += ',\n'.join(board_items)
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
if packagegen:
Expand Down
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