Open Micket opened 1 year ago
Improved my script a bit
#!/usr/bin/env python3
import sys
import requests
from easybuild.framework.easyconfig.parser import EasyConfigParser
def latest_cpan_extension(module):
data = requests.get('https://fastapi.metacpan.org/v1/module/' + module).json()
version = data['version']
url = data['download_url']
source_url, filename = url.rsplit('/', maxsplit=1)
source_tmpl = filename.replace(version, '%(version)s')
return (module, version, {'source_tmpl': source_tmpl, 'source_urls': [source_url]})
ec = EasyConfigParser(sys.argv[1])
ecdict = ec.get_config_dict(validate=False)
extensions = ecdict['exts_list']
new_extensions = []
print('exts_list = [')
for module in extensions:
opts = module[2]
new_mod, version, new_opts = latest_cpan_extension(module[0])
print(f" ('{new_mod}', '{version}', {{")
opts.update(new_opts)
for x, y in opts.items():
print(f' {repr(x)}: {repr(y)},')
print(' }),')
print(']')
A while back i found a way to automate updating of perl modules by fetching metadata from Perl.
needs to be cleaned up a bit, and added somewhere for convenient access. Presumably the perl bundle easyblock. I didn't have time to do it, and just manually copied in all the extensions myself.