summaryrefslogtreecommitdiffstats
path: root/pym/repoman
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-06-19 05:26:49 +0000
committerZac Medico <zmedico@gentoo.org>2008-06-19 05:26:49 +0000
commitb8f2743e6eb7377c410d2a36dec2f9fc908e1e9e (patch)
tree437128fe9a642e21740a25e2dbfd0c39bcfff6e0 /pym/repoman
parenteca8282d6d3b5011ec2660c288c1b768c1731cb6 (diff)
downloadportage-b8f2743e6eb7377c410d2a36dec2f9fc908e1e9e.tar.gz
portage-b8f2743e6eb7377c410d2a36dec2f9fc908e1e9e.tar.bz2
portage-b8f2743e6eb7377c410d2a36dec2f9fc908e1e9e.zip
Pass a Package instance into LineCheck.new(), and use this to avoid
passing the ebuild mtime into the EbuildHeader constructor (the mtime is given when the new() method is called). svn path=/main/trunk/; revision=10725
Diffstat (limited to 'pym/repoman')
-rw-r--r--pym/repoman/checks.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py
index afe5c8658..4b002568f 100644
--- a/pym/repoman/checks.py
+++ b/pym/repoman/checks.py
@@ -16,7 +16,7 @@ class LineCheck(object):
"""A regular expression to determine whether to ignore the line"""
ignore_line = False
- def new(self):
+ def new(self, pkg):
pass
def check(self, num, line):
@@ -45,9 +45,10 @@ class EbuildHeader(LineCheck):
gentoo_license = r'# Distributed under the terms of the GNU General Public License v2'
cvs_header = re.compile(r'^#\s*\$Header.*\$$')
- def __init__(self, st_mtime):
- self.modification_year = str(time.gmtime(st_mtime)[0])
- self.gentoo_copyright_re = re.compile(self.gentoo_copyright % self.modification_year)
+ def new(self, pkg):
+ self.modification_year = str(time.gmtime(pkg.mtime)[0])
+ self.gentoo_copyright_re = re.compile(
+ self.gentoo_copyright % self.modification_year)
def check(self, num, line):
if num > 2:
@@ -232,7 +233,7 @@ class InheritAutotools(LineCheck):
_autotools_func_re = re.compile(r'(^|\s)(' + \
"|".join(_autotools_funcs) + ')(\s|$)')
- def new(self):
+ def new(self, pkg):
self._inherit_autotools = None
self._autotools_func_call = None
@@ -256,7 +257,7 @@ class IUseUndefined(LineCheck):
repoman_check_name = 'IUSE.undefined'
_iuse_def_re = re.compile(r'^IUSE=.*')
- def new(self):
+ def new(self, pkg):
self._iuse_def = None
def check(self, num, line):
@@ -268,18 +269,17 @@ class IUseUndefined(LineCheck):
yield 'IUSE is not defined'
_constant_checks = tuple((c() for c in (
- EbuildWhitespace, EbuildQuote,
+ EbuildHeader, EbuildWhitespace, EbuildQuote,
EbuildAssignment, EbuildUselessDodoc,
EbuildUselessCdS, EbuildNestedDie,
EbuildPatches, EbuildQuotedA,
IUseUndefined, InheritAutotools)))
def run_checks(contents, pkg):
- checks = list(_constant_checks)
- checks.append(EbuildHeader(pkg.mtime))
+ checks = _constant_checks
for lc in checks:
- lc.new()
+ lc.new(pkg)
for num, line in enumerate(contents):
for lc in checks:
ignore = lc.ignore_line