Skip to content

Commit

Permalink
[install] in .github/workflows add an archiver.py script as suggested…
Browse files Browse the repository at this point in the history
… by Olivier to create a release info.dat file
  • Loading branch information
valassi committed Sep 28, 2024
1 parent cfdf1c0 commit 5c6fa4f
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/archiver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
# Copyright (C) 2020-2024 CERN and UCLouvain.
# Licensed under the GNU Lesser General Public License (version 3 or later).
# Created by: O. Mattelaer (Sep 2024) for the MG5aMC CUDACPP plugin.
# Further modified by: A. Valassi (2024) for the MG5aMC CUDACPP plugin.

import subprocess
import sys

def get_all_tags():
out = subprocess.check_output(['git', 'tag']).decode()
return out.split('\n')

def get_supported_versions(tags):
PREFIX = 'TEST_cudacpp_for'
SUFFIX = '_latest'
versions = [ t[len(PREFIX):-len(SUFFIX)] for t in tags if t.startswith(PREFIX) and t.endswith(SUFFIX)]
versions = set(versions)
return versions

def create_info_file(path, versions):
line = "%(version)s https://github.com/valassi/madgraph4gpu/releases/download/TEST_cudacpp_for%(version)s_latest/cudacpp.tar.gz\n"
fsock = open(path, 'w')
for v in versions:
fsock.write(line%{'version':v})

if "__main__" == __name__:
if len(sys.argv) != 2:
print('Usage: python3 %s <filename>'%sys.argv[0])
sys.exit(1)
tags = get_all_tags()
print(tags)
versions = get_supported_versions(tags)
print(versions)
create_info_file(sys.argv[1], versions)

0 comments on commit 5c6fa4f

Please sign in to comment.