23
23
24
24
Update.py should be run often enough to catch individual Matlab release updates.
25
25
"""
26
-
27
26
import re
28
- from subprocess import DEVNULL , run
27
+ from subprocess import DEVNULL
28
+ from subprocess import run
29
29
from urllib import request
30
30
31
- from packaging import version
32
31
from bs4 import BeautifulSoup
32
+ from packaging import version
33
33
34
34
REL_URL = "https://www.mathworks.com/products/compiler/matlab-runtime.html"
35
35
VER_LIMIT = "9.3" # release URLs get weird before that..
@@ -69,7 +69,7 @@ def call(cmd, split=True):
69
69
if "glnxa64" not in link :
70
70
raise RuntimeError ("Error parsing matlab release page link" )
71
71
if match := rel_re .search (link ):
72
- mcr_ver = "{ }.{}" . format ( mcr_ver , match .groups ()[0 ])
72
+ mcr_ver = f" { mcr_ver } .{ match .groups ()[0 ]} "
73
73
dockers .append ((mcr_name , mcr_ver , link ))
74
74
75
75
@@ -79,17 +79,17 @@ def call(cmd, split=True):
79
79
for docker in dockers :
80
80
mcr_name , mcr_ver , link = docker
81
81
if len (mcr_ver .split ("." )) == 2 :
82
- mcr_ver = mcr_ver + " .0"
83
- mcr_ver_maj = "." .join (mcr_ver .split ("." )[0 :2 ])
84
- mcr_ver_dir = "v{}" . format ( mcr_ver_maj .replace ("." , "" ))
85
- if not call ("git checkout {}" . format ( mcr_name ) ):
86
- call ("git checkout -b {}" . format ( mcr_name ) )
82
+ mcr_ver = f" { mcr_ver } .0"
83
+ mcr_ver_maj = "." .join (mcr_ver .split ("." )[:2 ])
84
+ mcr_ver_dir = f'v { mcr_ver_maj .replace ("." , "" )} '
85
+ if not call (f "git checkout { mcr_name } " ):
86
+ call (f "git checkout -b { mcr_name } " )
87
87
for (template , suffix ) in variants :
88
- tag = "{}{}" . format ( mcr_ver , suffix )
89
- if call ("git rev-parse --verify {}" . format ( tag ) ):
90
- print ("Skipping {}/{}, already present" . format ( mcr_name , tag ) )
88
+ tag = f" { mcr_ver } { suffix } "
89
+ if call (f "git rev-parse --verify { tag } " ):
90
+ print (f "Skipping { mcr_name } /{ tag } , already present" )
91
91
continue
92
- print ("Adding {}/{}" . format ( mcr_name , tag ) )
92
+ print (f "Adding { mcr_name } /{ tag } " )
93
93
if not call ("git merge master" ):
94
94
raise RuntimeError ("Merging master failed, will not continue" )
95
95
with open (template ) as f :
@@ -102,12 +102,12 @@ def call(cmd, split=True):
102
102
call ("git add Dockerfile" )
103
103
# Tag X.Y.Z[-variant] - see circle CI for shared tag X.Y[-variant]
104
104
call (["git" , "commit" , "-m" , "Auto-Update" ], split = False )
105
- call ("git tag {}" . format ( tag ) )
105
+ call (f "git tag { tag } " )
106
106
new_tags .append (tag )
107
107
call ("git checkout master" )
108
108
109
109
if new_tags :
110
110
print ("New tags have been added, verify and update to git with:" )
111
111
print ("git push --all" )
112
112
for tag in reversed (new_tags ):
113
- print ("git push origin {}" . format ( tag ) )
113
+ print (f "git push origin { tag } " )
0 commit comments