Blame SOURCES/galaxy_transform.py

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