Package conary :: Package conaryclient :: Module filetypes :: Class RegularFile
[hide private]
[frames] | no frames]

Class RegularFile

source code

object --+    
         |    
     _File --+
             |
            RegularFile


NAME
====

B{C{RegularFile}} - Define a regular file filestream helper.

SYNOPSIS
========

C{RegularFile([I{contents}, I{requires}, I{provides}, I{flavor}, I{mode}, I{owner}, I{group}, I{config}, I{initialContents}, I{transient}, I{tags}])}

DESCRIPTION
===========

The C{RegularFile} class defines a regular file filestream helper.  This
class takes I{contents} as an optional argument.

PARAMETERS
==========
The following parameters apply to the RegularFile class.

B{contents}: (None) defines the contents of the file.  This parameter can
be a string or a file-like object.

B{requires}: (None) Marks this file with the specified requirements.
This parameter is a deps.Dependency object.

B{provides}: (None) Marks files as providing certain features or
characteristics.  This parameter is a deps.Dependency object.

B{flavor}: (None) Marks this file with the specified flavor.  File
flavors are aggregated to determine trove flavors.  This parameter
is a deps.Flavor object.

B{owner}: ('root') Marks this file as owned by I{owner}.  This parameter
is a string

B{group}: ('root') Marks this file as belonging to I{group}.  This
parameter is a string

B{mode}: (0644) Defines the access permissons of the file.  This
parameter is an integer.

B{config}: (False) Marks this file as a config file.  This is the same
behavior as the Config Policy. A file marked as a config file cannot
also be marked as a transient file or an initialContents file.  Conary
enforces this requirement.

B{initialContents}: (False) Marks this file as a initialContents file.

B{transient}: (False) Marks this file as a transient file.

B{tags} : (None) Tags associated with this File.  When a file with a
tag is installed, removed, or changed, the listed tag handler is executed.
See documentation on tag handlers for more information.  This parameter
is a list of strings.

USER COMMANDS
=============
The following user commands are applicable to C{RegularFile}:

    - L{get(I{pathId})} : Returns a filestream with the settings
      represented by this class.

    - L{getContents() : Returns a seekable file object reflecting the
      contents associated with this filestream.

EXAMPLES
========

C{fileObj = RegularFile(contents = 'foo')}
C{fileObj.get()}

Creates a filestream helper with contents "foo", and retrieves the
filestream associated with it.



Nested Classes [hide private]
  fileClass
Instance Methods [hide private]
 
__init__(self, **kwargs) source code
 
getContents(self) source code
 
_touchupFileStream(self, f) source code
 
_enforceMutuallyExclusiveFlags(self) source code

Inherited from _File: get

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]
  needSha1 = True
  kwargs = {'config': False, 'contents': '', 'flavor': None, 'gr...

Inherited from _File: aliasedArgs

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **kwargs)
(Constructor)

source code 
Overrides: _File.__init__

getContents(self)

source code 
Overrides: _File.getContents

_touchupFileStream(self, f)

source code 
Overrides: _File._touchupFileStream

Class Variable Details [hide private]

kwargs

Value:
{'config': False,
 'contents': '',
 'flavor': None,
 'group': 'root',
 'initialContents': False,
 'linkGroup': None,
 'mtime': None,
 'owner': 'root',
...