Blame SOURCES/galaxy_transform.py

73f2b9
#!/usr/bin/python3
73f2b9
73f2b9
# Changes namespace, name, and version in Galaxy metadata.
73f2b9
# Useful for releasing to Automation Hub, where Collections live
73f2b9
# in namespaces separated from Ansible Galaxy.
73f2b9
73f2b9
import sys
73f2b9
from ruamel.yaml import YAML
73f2b9
73f2b9
filepath = "galaxy.yml"
73f2b9
73f2b9
buf = open(filepath).read()
73f2b9
73f2b9
yaml = YAML(typ="rt")
73f2b9
yaml.default_flow_style = False
73f2b9
yaml.preserve_quotes = True
73f2b9
yaml.indent(mapping=2, sequence=4, offset=2)
73f2b9
73f2b9
code = yaml.load(buf)
73f2b9
73f2b9
code["namespace"] = sys.argv[1]
73f2b9
code["name"] = sys.argv[2]
73f2b9
code["version"] = sys.argv[3]
73f2b9
yaml.dump(code, sys.stdout)