Package conary :: Package build :: Module policy :: Class Policy
[hide private]
[frames] | no frames]

Class Policy

source code

  action.Action --+        
                  |        
action.RecipeAction --+    
                      |    
             BasePolicy --+
                          |
                         Policy
Known Subclasses:
packagepolicy.ByDefault, packagepolicy.ComponentProvides, packagepolicy.ComponentRequires, packagepolicy._filterSpec, packagepolicy.Flavor, packagepolicy._dependency, packagepolicy._addInfo, packagepolicy.Config, packagepolicy.ExcludeDirectories, packagepolicy.InitialContents, packagepolicy.LinkCount, packagepolicy.LinkType, packagepolicy.MakeDevices, packagepolicy._UserGroup, UserGroupBasePolicy, PackagePolicy, packagepolicy.TagDescription, packagepolicy.TagHandler, packagepolicy.Transient, packagepolicy.reportErrors, packagepolicy.reportExcessBuildRequires, packagepolicy.reportMissingBuildRequires, packagepolicy.setModes, DestdirPolicy, EnforcementPolicy, destdirpolicy.FixDirModes, destdirpolicy.TestSuiteFiles, destdirpolicy.TestSuiteLinks

Abstract superclass for all policy actions. Policy actions that operate on the entire %(destdir)s implement the do method; Policy actions that operate on a per-file basis implement the doFile method. The doFile function is never called for files that match an exception regexp; do functions must implement their own exception regexp handling.

The class variables below apply automatically to the doFile method; classes implementing the do method instead may use them as well, but should use the same rules if they do use them. All of them have self.macros applied before use.

Instance Methods [hide private]
 
__init__(self, recipe, **keywords) source code
 
filterExpression(self, expression, name=None)
backwards compatibility
source code
 
filterExpArgs(self, expression, name=None) source code
 
compileFilters(self, expressionList, filterList, unusedList=None) source code
None
doProcess(self, recipe)
Invocation instance
source code
 
do(self) source code
 
walkDir(self, ignore, dirname, names) source code
 
mtimeChanged(self, path) source code
 
policyInclusion(self, filespec) source code
 
policyException(self, filespec) source code

Inherited from BasePolicy: dbg, error, info, postInit, postPolicy, updateArgs, warn

Inherited from BasePolicy (private): _addClassName, _pathAllowed

Inherited from action.RecipeAction: doAction, doPrep, doSuggestAutoBuildReqs, init_error

Inherited from action.Action: addArgs

Inherited from action.Action (private): _applyDefaults

Class Variables [hide private]
  bucket = None
boolean recursive = True
if True, walk entire subtrees; if False, work only on contents of listed directories (invariantsubtrees and subtrees).
  filetree = 1
where to look for files to which to apply the policy: policy.DESTDIR, the default, walks the files in the destdir, policy.BUILDDIR walks the files in the build directory, and policy.PACKAGE iterates over the packaged files rather than walking the destdir, which besides being possibly faster also applies to files that are not on the filesystem (like device nodes).
  rootdir = None
The root of the tree to walk for files, normally implied by the setting of filetree.
  processUnmodified = None
allows special handling for derived packages in order to make only appropriate changes in the derived package.
  keywords = {'exceptions': None, 'inclusions': None, 'subtrees'...
The keywords and default values accepted by the class
  invariantexceptions
subclasses may set to a list of exception filters that are always applied regardless of what other exceptions may be provided by the recipe; these exceptions being applied is an invariant condition of the doFile method.
  invariantinclusions
if invariantinclusions is not empty, then only files matching a filter in it are considered to be passed to to the doFile method.
  invariantsubtrees
if invariantsubtrees is not empty, then it is a list of subtrees (relative to %(destdir)s) to walk INSTEAD of walking the entire %(destdir)s tree.

Inherited from BasePolicy: allowUnusedFilters

Method Details [hide private]

__init__(self, recipe, **keywords)
(Constructor)

source code 
Parameters:
  • exceptions (None, filter string/tuple, or tuple/list of filter strings/tuples) - Optional argument; regexp(s) specifying files to ignore while taking the policy action. It will be interpolated against recipe macros before being used.
  • use (None, Use flag, or tuple/list of Use flags) - Optional argument; Use flag(s) telling whether to actually perform the action.
  • subtree (string or sequence of strings) - Subtree to which to limit the policy, or it it already is limited (invariantsubtrees), then additional subtrees to consider.
  • inclusions (FileFilter strings, FileFilter tuples, or list (not tuple) of FileFilter strings or FileFilter tuples.) - FileFilters to which to limit the policy, or if it already is limited (invariantinclusion) then additional FileFilters to include within the general limitation.
Overrides: BasePolicy.__init__

filterExpArgs(self, expression, name=None)

source code 
Parameters:
  • expression - regular expression or tuple of (regex, [setmode, [unsetmode]]) Creates arguments to filter.Filter.__init__

doProcess(self, recipe)

source code 
Invocation instance
Parameters:
  • recipe - holds the recipe object, which is used for the macro set and package objects.
Returns: None
None

do(self)

source code 
Overrides: action.RecipeAction.do

Class Variable Details [hide private]

processUnmodified

allows special handling for derived packages in order to make only appropriate changes in the derived package. None (default) disables the policy for derived packages. True causes doFile to be called for all files found, regardless of whether they are in the parent version, and False causes doFile to be called only for files that are new or have changed timestamps. Note that if filetree is policy.PACKAGE, unchanged file contents will lead to unchanged timestamps.
Value:
None

keywords

The keywords and default values accepted by the class
Value:
{'exceptions': None,
 'inclusions': None,
 'subtrees': None,
 'use': None}

invariantinclusions

if invariantinclusions is not empty, then only files matching a filter in it are considered to be passed to to the doFile method. Any exceptions, including invariants, are applied after invariantinclusions are applied; this means that all exceptions OVERRULE every type of inclusion.

invariantsubtrees

if invariantsubtrees is not empty, then it is a list of subtrees (relative to %(destdir)s) to walk INSTEAD of walking the entire %(destdir)s tree. Any subtrees are appended to invariantsubtrees.