Skip to content

Instantly share code, notes, and snippets.



Created Sep 10, 2018
What would you like to do?
#!/usr/bin/env python
from __future__ import print_function
import sys
import urllib
import yaml
import xml.etree.ElementTree as ET
f = open("distribution.yaml", "r+")
distribution = yaml.load(f)
# [[|axis_camera|target="_blank"]] ([[|axis_camera|target="_blank"]])
for repo_keys in distribution['repositories'].keys():
repo = distribution['repositories'][repo_keys]
# check only for unmtaintained packages
if repo.has_key('status') and repo['status'] == 'unmaintained':
# get package name
if repo['release'].has_key('packages'):
packages = repo['release']['packages']
packages = [repo_keys]
# get release information
version = repo['release']['version']
release_url = repo['release']['url']
tag = repo['release']['tags']['release']
# check maintainer name
manifest_url = release_url
manifest_url = manifest_url.replace('.git', '/{}/package.xml'.format(tag.format(package=packages[0],version=version)))
manifest_url = manifest_url.replace('', '')
#print("Loading from ... {}".format(manifest_url), file=sys.stderr)
tree = ET.parse(urllib.urlopen(manifest_url))
# get soruce information
if repo.has_key('source'):
source_url = repo['source']['url']
version = repo['source']['version']
elif repo.has_key('doc'):
source_url = repo['doc']['url']
version = repo['doc']['version']
#print( "maintainer ... ", [maintainer.attrib['email'] for maintainer in tree.iter('maintainer')],file=sys.stderr)
if any(maintainer.attrib['email'] in ['', '', ''] for maintainer in tree.iter('maintainer')):
#if any(maintainer.attrib['email'] in [''] for maintainer in tree.iter('maintainer')):
print(" * [[{repo}|{repo}|target=\"_black\"]] (".format(repo=repo_keys), end='')
print(" | ".join(list(map(lambda package : "[[{package}|{package}|target=\"_blank\"]]".format(package=package), packages))), end='')
print(" * source repository : [[{source_url}|{source_url}|target=\"_blank\"]]".format(source_url=source_url))
print(" * release repository : [[{release_url}|{release_url}|target=\"_blank\"]]".format(release_url=release_url))
print("{} is unmaintained but not orphaned".format(source_url), file=sys.stderr)
print(" maintainer ... ", [maintainer.attrib['email'] for maintainer in tree.iter('maintainer')],file=sys.stderr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment