pkgcore.fs.livefs module

interaction with the livefs: generating fs objects to represent the livefs.

pkgcore.fs.livefs.gen_obj(path, stat=None, chksum_handlers=None, real_location=None, stat_func=<built-in function lstat>, **overrides)[source]

given a fs path, and an optional stat, create an appropriate fs obj.

Parameters:
  • stat – stat object to reuse if available

  • real_location – real path to the object if path is the desired location, rather then existent location.

Raises:

KeyError – if no obj type matches the stat checks

Returns:

pkgcore.fs.fs.fsBase derivative

pkgcore.fs.livefs.iter_scan(path, offset=None, follow_symlinks=False, chksum_types=None, hidden=True, backup=True)[source]

Recursively scan a path.

Does not follow symlinks pointing at dirs, just merely yields an obj representing said symlink

Returns:

an iterator of pkgcore.fs.fs.fsBase objects.

Parameters:
  • path (str) – str path of what directory to scan in the livefs

  • offset – if not None, prefix to strip from each objects location. if offset is /tmp, /tmp/blah becomes /blah

pkgcore.fs.livefs.scan(*a, **kw)[source]

Alias for list(iter_scan(*a, **kw))

Look at iter_scan() for valid args.

pkgcore.fs.livefs.sorted_scan(path, nonexistent=False, *args, **kwargs)[source]

Recursively scan a path for regular, nonhidden files.

Parameters:
  • path (str) – path to directory to scan in the livefs

  • nonexistent (bool) – return nonexistent given path if True, else return an empty list

Returns:

an alphabetically sorted list of regular, nonhidden file locations accessible under the given path

Raises:

EnvironmentError – on permission errors

See iter_scan() for other valid args.