66
77import subprocess
88import sys
9+ import re
910
1011def get_all_tags ():
1112 out = subprocess.check_output([' git' , ' tag' ]).decode()
1213 return out.split(' \n' )
1314
1415def get_supported_versions(tags):
15- versions = [ t[len(PREFIX):-len(SUFFIX)] for t in tags if t.startswith(PREFIX) and t.endswith(SUFFIX)]
16+ # versions = [ t[len(PREFIX):-len(SUFFIX)] for t in tags if t.startswith(PREFIX) and t.endswith(SUFFIX)]
17+ versions = re.findall(rf" {PREFIX}(\d+.\d+.\d+)_v(\d+.\d+.\d+)$" ," \n" .join(tags), re.M)
1618 versions = set(versions)
1719 return versions
1820
19- def create_infodat_file(path, versions ):
20- line = " %(version)s https://github.com/%(repo)s/releases/download/%(prefix)s%(version)s %(suffix)s/cudacpp.tar.gz\n"
21- with open(path, ' w' ) as fsock:
22- for v in versions :
23- fsock.write(line%{' repo' :GITHUB_REPO, ' prefix' :PREFIX, ' version' :v, ' suffix' :SUFFIX })
21+ def create_infodat_file(path, mg_cudacpp_versions ):
22+ line = " %(version)s https://github.com/%(repo)s/releases/download/%(prefix)s%(version)s_v %(suffix)s/cudacpp.tar.gz\n"
23+ with open(path, ' w+ ' ) as fsock:
24+ for v, c in mg_cudacpp_versions :
25+ fsock.write(line%{' repo' :GITHUB_REPO, ' prefix' :PREFIX, ' version' :v, ' suffix' :c })
2426
2527if " __main__" == __name__:
2628 if len(sys.argv) ! = 3:
@@ -36,8 +38,8 @@ def create_infodat_file(path, versions):
3638 PREFIX = ' cudacpp_for'
3739 if repo_owner ! = ' madgraph5' : PREFIX = repo_owner + " _" + PREFIX # TEMPORARY! this will change eventually...
3840 if repo_name ! = ' madgraph4gpu' : raise Exception(' Invalid repo_name "%s" (expect "madgraph4gpu")' %repo_name) # TEMPORARY! this will change eventually...
39- SUFFIX = ' _latest'
4041 tags = get_all_tags ()
42+ # SUFFIX = '_latest'
4143 # ##print('Tags:', tags)
4244 versions = get_supported_versions(tags)
4345 # ##print('Supported versions:', versions)
0 commit comments