From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SZsCE-0003rG-OU for garchives@archives.gentoo.org; Wed, 30 May 2012 23:20:56 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EA0A3E0886; Wed, 30 May 2012 23:20:46 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id AC78CE0886 for ; Wed, 30 May 2012 23:20:46 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 502911B4035 for ; Wed, 30 May 2012 23:20:44 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 04A72E5428 for ; Wed, 30 May 2012 23:20:43 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1338420027.597826a1cabf654f9b3fff88425d04303e921577.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/repoman/ X-VCS-Repository: proj/portage X-VCS-Files: pym/repoman/checks.py X-VCS-Directories: pym/repoman/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 597826a1cabf654f9b3fff88425d04303e921577 X-VCS-Branch: master Date: Wed, 30 May 2012 23:20:43 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: c064865a-b64b-4d00-b68f-1bd99bb382a4 X-Archives-Hash: 745a2823b38eccd2b541aff2461be181 commit: 597826a1cabf654f9b3fff88425d04303e921577 Author: Zac Medico gentoo org> AuthorDate: Wed May 30 23:20:27 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed May 30 23:20:27 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D597826a1 InheritEclass: move eclass info to a dict This handles the info more like it will be handled when we parse it directly from eclasses. --- pym/repoman/checks.py | 175 +++++++++++++++++++++++++------------------= ----- 1 files changed, 91 insertions(+), 84 deletions(-) diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index 94dcfbe..5d56888 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -6,13 +6,14 @@ and correctness of an ebuild.""" =20 import codecs +from itertools import chain import re import time import repoman.errors as errors import portage from portage.eapi import eapi_supports_prefix, eapi_has_implicit_rdepend= , \ eapi_has_src_prepare_and_src_configure, eapi_has_dosed_dohard, \ - eapi_exports_AA, eapi_exports_KV + eapi_exports_AA =20 class LineCheck(object): """Run a check on a line of an ebuild.""" @@ -452,14 +453,19 @@ class InheritEclass(LineCheck): Base class for checking for missing inherits, as well as excess inherit= s. =20 Args: - _eclass: Set to the name of your eclass. - _funcs: A tuple of functions that this eclass provides. - _comprehensive: Is the list of functions complete? - _exempt_eclasses: If these eclasses are inherited, disable the missing + eclass: Set to the name of your eclass. + funcs: A tuple of functions that this eclass provides. + comprehensive: Is the list of functions complete? + exempt_eclasses: If these eclasses are inherited, disable the missing inherit check. """ =20 - def __init__(self): + def __init__(self, eclass, funcs=3DNone, comprehensive=3DFalse, + exempt_eclasses=3DNone): + self._eclass =3D eclass + self._funcs =3D funcs + self._comprehensive =3D comprehensive + self._exempt_eclasses =3D exempt_eclasses self._inherit_re =3D re.compile(r'^\s*inherit\s(.*\s)?%s(\s|$)' % self= ._eclass) self._func_re =3D re.compile(r'\b(' + '|'.join(self._funcs) + r')\b') =20 @@ -469,7 +475,7 @@ class InheritEclass(LineCheck): # have been inherited and not just the ones we inherit directly. self._inherit =3D False self._func_call =3D False - if hasattr(self, '_exempt_eclasses'): + if self._exempt_eclasses is not None: self._disabled =3D any(x in pkg.inherited for x in self._exempt_eclas= ses) else: self._disabled =3D False @@ -493,78 +499,80 @@ class InheritEclass(LineCheck): self.repoman_check_name =3D 'inherit.unused' yield 'no function called from %s.eclass; please drop' % self._eclass =20 -class InheritAutotools(InheritEclass): - _eclass =3D 'autotools' - _funcs =3D ( - 'eaclocal', 'eautoconf', 'eautoheader', - 'eautomake', 'eautoreconf', '_elibtoolize', - 'eautopoint' - ) - _comprehensive =3D True - - # Exempt eclasses: - # git - An EGIT_BOOTSTRAP variable may be used to call one of - # the autotools functions. - # subversion - An ESVN_BOOTSTRAP variable may be used to call one of - # the autotools functions. - _exempt_eclasses =3D frozenset(['git', 'subversion', 'autotools-utils']= ) - -class InheritEutils(InheritEclass): - _eclass =3D 'eutils' - _funcs =3D ( - 'estack_push', 'estack_pop', 'eshopts_push', 'eshopts_pop', - 'eumask_push', 'eumask_pop', 'epatch', 'epatch_user', - 'emktemp', 'edos2unix', 'in_iuse', 'use_if_iuse', 'usex', - 'makeopts_jobs' - ) - _comprehensive =3D False - - # These are "eclasses are the whole ebuild" type thing. - _exempt_eclasses =3D frozenset(['toolchain', 'toolchain-binutils']) - -class InheritFlagOMatic(InheritEclass): - _eclass =3D 'flag-o-matic' - _funcs =3D ( - 'filter-(ld)?flags', 'strip-flags', 'strip-unsupported-flags', - 'append-((ld|c(pp|xx)?))?flags', 'append-libs', - ) - _comprehensive =3D False - -class InheritLibtool(InheritEclass): - _eclass =3D 'libtool' - _funcs =3D ( - 'elibtoolize', - ) - _comprehensive =3D True - -class InheritMultilib(InheritEclass): - _eclass =3D 'multilib' - _funcs =3D ( - 'get_libdir', - ) - _comprehensive =3D False - -class InheritPrefix(InheritEclass): - _eclass =3D 'prefix' - _funcs =3D ( - 'eprefixify', - ) - _comprehensive =3D True - -class InheritToolchainFuncs(InheritEclass): - _eclass =3D 'toolchain-funcs' - _funcs =3D ( - 'gen_usr_ldscript', - ) - _comprehensive =3D False - -class InheritUser(InheritEclass): - _eclass =3D 'user' - _funcs =3D ( - 'enewuser', 'enewgroup', - 'egetent', 'egethome', 'egetshell' - ) - _comprehensive =3D True +_eclass_info =3D { + 'autotools': { + 'funcs': ( + 'eaclocal', 'eautoconf', 'eautoheader', + 'eautomake', 'eautoreconf', '_elibtoolize', + 'eautopoint' + ), + 'comprehensive': True, + + # Exempt eclasses: + # git - An EGIT_BOOTSTRAP variable may be used to call one of + # the autotools functions. + # subversion - An ESVN_BOOTSTRAP variable may be used to call one of + # the autotools functions. + 'exempt_eclasses': ('git', 'subversion', 'autotools-utils') + }, + + 'eutils': { + 'funcs': ( + 'estack_push', 'estack_pop', 'eshopts_push', 'eshopts_pop', + 'eumask_push', 'eumask_pop', 'epatch', 'epatch_user', + 'emktemp', 'edos2unix', 'in_iuse', 'use_if_iuse', 'usex', + 'makeopts_jobs' + ), + 'comprehensive': False, + + # These are "eclasses are the whole ebuild" type thing. + 'exempt_eclasses': frozenset(['toolchain', 'toolchain-binutils']) + }, + + 'flag-o-matic': { + 'funcs': ( + 'filter-(ld)?flags', 'strip-flags', 'strip-unsupported-flags', + 'append-((ld|c(pp|xx)?))?flags', 'append-libs', + ), + 'comprehensive': False + }, + + 'libtool': { + 'funcs': ( + 'elibtoolize', + ), + 'comprehensive': True + }, + + 'multilib': { + 'funcs': ( + 'get_libdir', + ), + 'comprehensive': False + }, + + 'prefix': { + 'funcs': ( + 'eprefixify', + ), + 'comprehensive': True + }, + + 'toolchain-funcs': { + 'funcs': ( + 'gen_usr_ldscript', + ), + 'comprehensive': False + }, + + 'user': { + 'funcs': ( + 'enewuser', 'enewgroup', + 'egetent', 'egethome', 'egetshell' + ), + 'comprehensive': True + } +} =20 class IUseUndefined(LineCheck): """ @@ -739,20 +747,19 @@ class PortageInternal(LineCheck): if m is not None: return ("'%s'" % m.group(2)) + " called on line: %d" =20 -_constant_checks =3D tuple((c() for c in ( +_constant_checks =3D tuple(chain((c() for c in ( EbuildHeader, EbuildWhitespace, EbuildBlankLine, EbuildQuote, EbuildAssignment, Eapi3EbuildAssignment, EbuildUselessDodoc, EbuildUselessCdS, EbuildNestedDie, EbuildPatches, EbuildQuotedA, EapiDefinition, - ImplicitRuntimeDeps, InheritAutotools, InheritDeprecated, InheritEutils= , - InheritFlagOMatic, InheritMultilib, InheritLibtool, InheritPrefix, - InheritToolchainFuncs, InheritUser, IUseUndefined, + ImplicitRuntimeDeps, IUseUndefined, EMakeParallelDisabled, EMakeParallelDisabledViaMAKEOPTS, NoAsNeeded, DeprecatedBindnowFlags, SrcUnpackPatches, WantAutoDefaultValue, SrcCompileEconf, Eapi3DeprecatedFuncs, NoOffsetWithHelpers, Eapi4IncompatibleFuncs, Eapi4GoneVars, BuiltWithUse, PreserveOldLib, SandboxAddpredict, PortageInternal, - DeprecatedUseq, DeprecatedHasq))) + DeprecatedUseq, DeprecatedHasq)), + (InheritEclass(k, **kwargs) for k, kwargs in _eclass_info.items()))) =20 _here_doc_re =3D re.compile(r'.*\s<<[-]?(\w+)$') _ignore_comment_re =3D re.compile(r'^\s*#')