- copyfile(path,
- final_path + '/' + fields.get('id') + "-" + fields.get('version') + '.tar.gz')
- ruamel.yaml.dump(fields, open(final_path + '/' + 'metadata.yaml', 'w'),
- Dumper=ruamel.yaml.RoundTripDumper)
- index = ruamel.yaml.load(open(destination + '/index.yaml'), Loader=ruamel.yaml.Loader)
-
- index['{}_packages'.format(package_type)][fields.get('id')][fields.get('version')] = data_ind
- if versioning.parse(index['{}_packages'.format(package_type)][fields.get('id')][
- 'latest']) < versioning.parse(fields.get('version')):
- index['{}_packages'.format(package_type)][fields.get('id')]['latest'] = fields.get(
- 'version')
- ruamel.yaml.dump(index, open(destination + '/index.yaml', 'w'), Dumper=ruamel.yaml.RoundTripDumper)
- self._logger.info('{} {} added in the repository'.format(package_type.upper(), str(path)))
+ copyfile(
+ path,
+ final_path
+ + "/"
+ + fields.get("id")
+ + "-"
+ + fields.get("version")
+ + ".tar.gz",
+ )
+ yaml.safe_dump(
+ fields,
+ open(final_path + "/" + "metadata.yaml", "w"),
+ default_flow_style=False,
+ width=80,
+ indent=4,
+ )
+ index = yaml.safe_load(open(destination + "/index.yaml"))
+
+ index["{}_packages".format(package_type)][fields.get("id")][
+ fields.get("version")
+ ] = data_ind
+ if versioning.parse(
+ index["{}_packages".format(package_type)][fields.get("id")][
+ "latest"
+ ]
+ ) < versioning.parse(fields.get("version")):
+ index["{}_packages".format(package_type)][fields.get("id")][
+ "latest"
+ ] = fields.get("version")
+ yaml.safe_dump(
+ index,
+ open(destination + "/index.yaml", "w"),
+ default_flow_style=False,
+ width=80,
+ indent=4,
+ )
+ self._logger.info(
+ "{} {} added in the repository".format(
+ package_type.upper(), str(path)
+ )
+ )