Generic support code (not 0install-specific)
finally cleanup x f calls f x and then cleanup x (even if f x raised an exception) *
handle_exceptions main args runs main args. If it throws an exception it reports it in a
user-friendly way. A Safe_exception is displayed with its context.
If stack-traces are enabled, one will be displayed. If not then, if the exception isn't
a Safe_exception, the user is told how to enable them.
On error, it calls exit 1. On success, it returns.
Collections
Return the first non-None result of fn item for items in the list.
List the non-None results of fn item
List the non-None results of fn item
Extract a sub-list.
Wrapper for Sys.getenv that gives a more user-friendly exception message.
Try to guess the full path of the executable that the user means.
On Windows, we add a ".exe" extension if it's missing.
If the name contains a dir_sep, just check that abspath name exists.
Otherwise, search $PATH for it.
On Windows, we also search '.' first. This mimicks the behaviour the Windows shell.
Spawn a subprocess with the given arguments and call fn channel on its output.
Read up to n bytes from ch (less if we hit end-of-file.
Create a randomly-named subdirectory inside parent.
Copy from ic to oc until End_of_file
Normalize a path, e.g. A//B, A/./B and A/foo/../B all become A/B.
It should be understood that this may change the meaning of the path
if it contains symbolic links (use realpath instead if you care about that).
Based on the Python version.