Home | Trees | Indices | Help |
|
---|
|
object --+ | list --+ | FilesystemList
Represents a list of filesystem items.
This is a generic class that represents a list of filesystem items. Callers can add individual files or directories to the list, or can recursively add the contents of a directory. The class also allows for up-front exclusions in several forms (all files, all directories, all items matching a pattern, all items whose basename matches a pattern, or all directories containing a specific "ignore file"). Symbolic links are typically backed up non-recursively, i.e. the link to a directory is backed up, but not the contents of that link (we don't want to deal with recursive loops, etc.).
The custom methods such as addFile will only add items if they exist on the
filesystem and do not match any exclusions that are already in place.
However, since a FilesystemList is a subclass of Python's standard list
class, callers can also add items to the list in the usual way, using
methods like append()
or insert()
. No
validations apply to items added to the list in this way; however, many
list-manipulation methods deal "gracefully" with items that
don't exist in the filesystem, often by ignoring them.
Once a list has been created, callers can remove individual items from
the list using standard methods like pop()
or
remove()
or they can use custom methods to remove specific
types of entries or entries which match a particular pattern.
^
and end
with $
. This is true whether we are matching a
complete path or a basename.
|
|||
new list |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from |
|
|||
excludeFiles Boolean indicating whether files should be excluded. |
|||
excludeDirs Boolean indicating whether directories should be excluded. |
|||
excludeLinks Boolean indicating whether soft links should be excluded. |
|||
excludePaths List of absolute paths to be excluded. |
|||
excludePatterns List of regular expression patterns (matching complete path) to be excluded. |
|||
excludeBasenamePatterns List of regular expression patterns (matching basename) to be excluded. |
|||
ignoreFile Name of file which will cause directory contents to be ignored. |
|||
Inherited from |
|
Initializes a list with no configured exclusions.
|
Adds a file to the list. The path must exist and must be a file or a link to an existing file. It will be added to the list subject to any exclusions that are in place.
|
Adds a directory to the list. The path must exist and must be a directory or a link to an existing directory. It will be added to the list subject to any exclusions that are in place. The ignoreFile does not apply to this method, only to addDirContents.
|
Adds the contents of a directory to the list. The path must exist and must be a directory or a link to a directory.
The contents of the directory (as well as the directory path itself) will
be recursively added to the list, subject to any exclusions that are in
place. If you only want the directory and its immediate contents to be
added, then pass in
Notes:
|
Removes file entries from the list. If This method might be fairly slow for large lists, since it must check
the type of each item in the list. If you know ahead of time that you
want to exclude all files, then you will be better off setting excludeFiles to
|
Removes directory entries from the list. If This method might be fairly slow for large lists, since it must check
the type of each item in the list. If you know ahead of time that you
want to exclude all directories, then you will be better off setting excludeDirs to
|
Removes soft link entries from the list. If This method might be fairly slow for large lists, since it must check
the type of each item in the list. If you know ahead of time that you
want to exclude all soft links, then you will be better off setting excludeLinks to
|
Removes from the list all entries matching a pattern. This method removes from the list all entries which match the passed
in
Note: Unlike when using the exclude lists, the pattern here is not bounded at the front and the back of the string. You can use any pattern you want. |
Removes from the list all entries that do not exist on disk. This method removes from the list all entries which do not currently exist on disk in some form. No attention is paid to whether the entries are files or directories.
|
Property target used to set the exclude files flag. No validations,
but we normalize the value to |
Property target used to set the exclude directories flag. No
validations, but we normalize the value to |
Property target used to set the exclude soft links flag. No
validations, but we normalize the value to |
Property target used to set the exclude paths list. A
|
Property target used to set the exclude patterns list. A
|
Property target used to set the exclude basename patterns list. A
|
Property target used to set the ignore file. The value must be a
non-empty string if it is not
|
Internal implementation of This internal implementation exists due to some refactoring.
Basically, some subclasses have a need to add the contents of a
directory, but not the directory itself. This is different than the
standard The linkDepth parameter controls whether soft links are followed when we are adding the contents recursively. Any recursive calls reduce the value by one. If the value zero or less, then soft links will just be added as directories, but will not be followed. This means that links are followed to a constant depth starting from the top-most directory. There is one difference between soft links and directories: soft links that are added recursively are not placed into the list explicitly. This is because if we do add the links recursively, the resulting tar file gets a little confused (it has a link and a directory with the same name).
Note: If you call this method on a link to a directory that link will never be dereferenced (it may, however, be followed). |
Verifies that all entries in the list exist on disk.
|
|
excludeFilesBoolean indicating whether files should be excluded.
|
excludeDirsBoolean indicating whether directories should be excluded.
|
excludeLinksBoolean indicating whether soft links should be excluded.
|
excludePathsList of absolute paths to be excluded.
|
excludePatternsList of regular expression patterns (matching complete path) to be excluded.
|
excludeBasenamePatternsList of regular expression patterns (matching basename) to be excluded.
|
ignoreFileName of file which will cause directory contents to be ignored.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Jan 10 18:01:37 2010 | http://epydoc.sourceforge.net |