diff options
author | Markus Meier <maekke@gentoo.org> | 2013-07-30 00:17:33 +0200 |
---|---|---|
committer | Markus Meier <maekke@gentoo.org> | 2013-07-30 00:17:33 +0200 |
commit | 2ea9b8798ec3d10bacaa832a42508cdb789e9d3a (patch) | |
tree | 74bacb3fdfe8e452c77bb5b7d6a2d500cd30f5c7 /scripts | |
parent | fix repoman warnings (diff) | |
download | maekke-2ea9b8798ec3d10bacaa832a42508cdb789e9d3a.tar.gz maekke-2ea9b8798ec3d10bacaa832a42508cdb789e9d3a.tar.bz2 maekke-2ea9b8798ec3d10bacaa832a42508cdb789e9d3a.zip |
add script to run repoman LineChecks on eclasses
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/repoman-checks-eclass.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/scripts/repoman-checks-eclass.py b/scripts/repoman-checks-eclass.py new file mode 100755 index 0000000..fd8b575 --- /dev/null +++ b/scripts/repoman-checks-eclass.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +import io +import os +import sys +from repoman.checks import run_checks + +class DummyPkg: + def __init__(self, name): + self.name = name + self.mtime = None + self.eapi = 0 + self.inherited = '' + +class RepoClass: + def __init__(self): + self._repodir = None + + def run(self, repodir=None): + self._repodir = repodir + eclasses = self._getEclasses() + self._runChecks(eclasses) + + def _getEclasses(self): + eclasses = [] + eclassdir = os.path.join(self._repodir, 'eclass') + for file in os.listdir(eclassdir): + if file.endswith('.eclass'): + eclasses.append(os.path.join(eclassdir, file)) + eclasses.sort() + return eclasses + + def _runChecks(self, eclasses): + for eclass in eclasses: + pkg = DummyPkg(eclass) + f = io.open(eclass, mode='r') + try: + for check_name, e in run_checks(f, pkg): + if not e.startswith('valid EAPI assignment must occur on or before line'): + print '%s --> %s: %s' % (os.path.basename(eclass), check_name, e) + finally: + f.close() + +rc = RepoClass() +rc.run(repodir=sys.argv[1]) |