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

Class Create

source code

  action.Action --+            
                  |            
action.RecipeAction --+        
                      |        
            BuildAction --+    
                          |    
                _FileAction --+
                              |
                             Create

NAME

r.Create() - Creates a file

SYNOPSIS

r.Create(emptyfile, [contents,] [macros,] [mode])

DESCRIPTION

The r.Create() class is called from within a Conary recipe to create a file. The file may be created empty, or with with contents specified optionally.

Without contents specified, r.Create() behaves like touch foo. If contents is specified r.Create acts more like cat > foo <<EOF ... EOF. If contents is not empty, then a newline will be implicitly appended unless contents already ends in a newline.

KEYWORDS

The r.Create() class accepts the following keywords:

contents : The (optional) contents of the file

macros : Whether to interpolate macros into the contents

mode : The mode of the file (defaults to 0644)

package : (None) If set, must be a string that specifies the package (package='packagename'), component (package=':componentname'), or package and component (package='packagename:componentname') in which to place the files added while executing this command. Previously-specified PackageSpec or ComponentSpec lines will override the package specification, since all package and component specifications are considered in strict order as provided by the recipe.

EXAMPLES

r.Create('%(localstatedir)s/log/acpid', mode=0640)

Demonstrates calling r.Create() specifying the creation of %(localstatedir)s/log/acpid with mode 0640.

Instance Methods [hide private]
 
do(self, macros)
Do the build action
source code
 
__init__(self, recipe, *args, **keywords) source code

Inherited from _FileAction: chmod, setComponents

Inherited from BuildAction: doAction, initManifest, missingFiles

Inherited from action.RecipeAction: doPrep, doSuggestAutoBuildReqs, init_error

Inherited from action.Action: addArgs

Inherited from action.Action (private): _applyDefaults

Class Variables [hide private]
  keywords = {'contents': '', 'macros': True, 'mode': 420}

Inherited from _FileAction: useExplicitManifest

Method Details [hide private]

do(self, macros)

source code 
Do the build action
Overrides: BuildAction.do
(inherited documentation)

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

source code 
Parameters:
  • contents - The (optional) contents of the file
  • macros - Whether or not to interpolate macros into the contents
  • mode - The mode of the file (defaults to 0644)
Overrides: _FileAction.__init__