Package zeroinstall :: Package support
[frames] | no frames]

Package support

source code

Useful support routines (for internal use).

These functions aren't really Zero Install specific; they're things we might wish were in the standard library.


Since: 0.27

Submodules

Functions
 
find_in_path(prog)
Search $PATH for prog.
source code
 
read_bytes(fd, nbytes, null_ok=False)
Read exactly nbytes from fd.
source code
str
pretty_size(size)
Format a size for printing.
source code
 
ro_rmtree(root)
Like shutil.rmtree, except that we also delete read-only items.
source code
Function Details

find_in_path(prog)

source code 

Search $PATH for prog. If prog is an absolute path, return it unmodified.

Parameters:
  • prog - name of executable to find
Returns:
the full path of prog, or None if not found

Since: 0.27

read_bytes(fd, nbytes, null_ok=False)

source code 

Read exactly nbytes from fd.

Parameters:
  • fd - file descriptor to read from
  • nbytes - number of bytes to read
  • null_ok - if True, it's OK to receive EOF immediately (we then return None)
Returns:
the bytes read
Raises:
  • Exception - if we received less than nbytes of data

pretty_size(size)

source code 

Format a size for printing.

Parameters:
  • size (int (or None)) - the size in bytes
Returns: str
the formatted size

Since: 0.27

ro_rmtree(root)

source code 

Like shutil.rmtree, except that we also delete read-only items.

Parameters:
  • root (str) - the root of the subtree to remove

Since: 0.28