Blame SOURCES/galaxy_transform.py

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