Commit bb641fc1 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Merge branch 'rf/recipe-url' into 'master'

RF: Drop trailing slashes from recipe URLs

See merge request fsl/conda/fsl-ci-rules!104
parents a61b2426 ef30fcc5
......@@ -20,7 +20,7 @@ import subprocess as sp
import yaml
__version__ = '0.19.3'
__version__ = '0.19.4'
"""Current version of the fsl-ci-rules."""
......
......@@ -73,6 +73,7 @@ def get_recipe_urls(project_name, server) -> Dict[str, str]:
recipes = []
for url in urls:
url = url.rstrip('/')
path = urlparse.urlparse(url).path.replace('.git', '')[1:]
name = path.rsplit('/', 1)[-1]
recipes.append({'url' : url, 'name' : name, 'path' : path})
......
......@@ -64,12 +64,16 @@ def update_recipe_variable(text : str, varname : str, newvalue : str) -> str:
Returns the patched text.
"""
pat = r'{{% +set +{} += +[\'"](.*)[\'"] +%}}'.format(varname)
pat = r'{{% +set +{}( +)=( +)[\'"](.*)[\'"] +%}}'.format(varname)
lines = list(text.split('\n'))
for i, line in enumerate(lines):
if re.fullmatch(pat, line.strip()):
lines[i] = "{{% set {} = '{}' %}}".format(varname, newvalue)
match = re.fullmatch(pat, line.strip())
if match:
space1 = match.group(1)
space2 = match.group(2)
lines[i] = "{{% set {}{}={}'{}' %}}".format(
varname, space1, space2, newvalue)
break
return '\n'.join(lines)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment