Package conary :: Package lib :: Module util
[hide private]
[frames] | no frames]

Module util

source code

Classes [hide private]
  popen
Version of popen() that throws errors on close(), unlike os.popen()
  ObjectCache
Implements a cache of arbitrary (hashable) objects where an object can be looked up and have its cached value retrieved.
  SendableFileSet
  ExtendedFdopen
  ExtendedFile
  ExtendedStringIO
  SeekableNestedFile
  BZ2File
  PeekIterator
  IterableQueue
  LineReader
  _LazyFile
  LazyFileCache
An object tracking open files.
  Flags
  FileIgnoreEpipe
  BoundedStringIO
An IO object that behaves like a StringIO.
  ProtectedString
A string that is not printed in tracebacks
  ProtectedTemplate
A string template that hides parts of its components.
  XMLRPCMarshaller
Marshaller for XMLRPC data
  XMLRPCUnmarshaller
  ServerProxy
  Timer
  LZMAFile
Functions [hide private]
 
normpath(path) source code
 
realpath(path) source code
 
isregular(path) source code
 
mkdirChain(*paths) source code
 
_searchVisit(arg, dirname, names) source code
 
searchPath(file, basepath) source code
 
searchFile(file, searchdirs, error=None) source code
 
findFile(file, searchdirs) source code
 
which(filename) source code
 
recurseDirectoryList(topdir, withDirs=False)
Recursively list all files in the directory
source code
 
normurl(url) source code
 
genExcepthook(debug=True, debugCtrlC=False, prefix='conary-error-', catchSIGUSR1=True, error='\nERROR: An unexpected condition has occurred in Conary. Thi...) source code
 
_handle_rc(rc, cmd) source code
 
execute(cmd, destDir=None, verbose=True)
similar to os.system, but raises errors if exit code != 0 and closes stdin so processes can never block on user input
source code
 
find(s, subs, start=0) source code
 
literalRegex(s) source code
 
braceExpand(path) source code
 
braceGlob(paths)
PUBLIC API
source code
 
rmtree(paths, ignore_errors=False, onerror=None) source code
 
_permsVisit(arg, dirname, names) source code
 
remove(paths, quiet=False) source code
 
copyfile(sources, dest, verbose=True) source code
 
copyfileobj(source, dest, callback=None, digest=None, abortCheck=None, bufSize=131072, rateLimit=None, sizeLimit=None, total=0) source code
 
rename(sources, dest) source code
 
_copyVisit(arg, dirname, names) source code
 
copytree(sources, dest, symlinks=False, filemode=None, dirmode=None)
Copies tree(s) from sources to dest, returning a list of the filenames that it has written.
source code
 
checkPath(binary, root=None)
Examine $PATH to determine if a binary exists, returns full pathname if it exists; otherwise None.
source code
 
joinPaths(*args) source code
 
splitPathReverse(path)
Split the path at the operating system's separators.
source code
 
splitPath(path)
Split the path at the operating system's separators Empty path components are stripped out Example: 'a//b//c/d' -> ['a', 'b', 'c', 'd']
source code
 
assertIteratorAtEnd(iter) source code
 
memsize(pid=None) source code
 
memusage(pid=None)
Get the memory usage.
source code
 
createLink(src, to) source code
 
tupleListBsearchInsert(haystack, newItem, cmpFn)
Inserts newItem into haystack, maintaining the sorted order.
source code
 
settempdir(tempdir) source code
 
mkstemp(suffix='', prefix='tmp', dir=None, text=False)
a wrapper for tempfile.mkstemp that uses a common prefix which is set through settempdir()
source code
 
verFormat(cfg, version)
Format the version according to the options in the cfg object
source code
 
lstat(path)
Return None if the path doesn't exist.
source code
 
stripUserPassFromUrl(url) source code
 
formatTrace(excType, excValue, tb, stream=sys.stdout, withLocals=True) source code
 
xmlrpcGetParser() source code
 
xmlrpcDump(params, methodname=None, methodresponse=None, stream=None, encoding=None, allow_none=False) source code
 
xmlrpcLoad(stream) source code
 
copyStream(src, dest, length=None, bufferSize=16384)
Copy from one stream to another, up to a specified length
source code
 
decompressStream(src, bufferSize=8092) source code
 
compressStream(src, level=5, bufferSize=16384) source code
 
massCloseFileDescriptors(start, unusedCount)
Close all file descriptors starting with start, until we hit unusedCount consecutive file descriptors that were already closed
source code
 
nullifyFileDescriptor(fdesc)
Connects the file descriptor to /dev/null or an open file (if /dev/null does not exist)
source code
None
sendmsg(sock, dataList, fdList=[])
Sends multiple strings and an optional list of file descriptors through a unix domain socket.
source code
tuple
recvmsg(sock, dataSize, fdCount=0)
Receives data and optional file descriptors from a unix domain socket.
source code
 
countOpenFileDescriptors()
Return the number of open file descriptors for this process.
source code
 
convertPackageNameToClassName(pkgname) source code
Variables [hide private]
  errorMessage = '\nERROR: An unexpected condition has occurred ...
  _debugAll = False
  _tempdir = '/tmp'
Function Details [hide private]

braceGlob(paths)

source code 
PUBLIC API
Decorators:
  • @api.publicApi
Raises:
  • ValueError - raised if paths has unbalanced braces
  • OSError - raised in some cases where lstat on a path fails

splitPathReverse(path)

source code 
Split the path at the operating system's separators. Returns a list with the path components in reverse order. Empty path components are stripped out. Example: 'a//b//c/d' -> ['d', 'c', 'b', 'a']

memusage(pid=None)

source code 
Get the memory usage.
Parameters:
  • pid - Process to analyze (None for current process)

tupleListBsearchInsert(haystack, newItem, cmpFn)

source code 
Inserts newItem into haystack, maintaining the sorted order. The cmpIdx is the item number in the list of tuples to base comparisons on. Duplicates items aren't added.
Parameters:
  • haystack (list) - list of tuples.
  • newItem (tuple) - The item to be inserted
  • cmpFn (function) - Comparison function

sendmsg(sock, dataList, fdList=[])

source code 
Sends multiple strings and an optional list of file descriptors through a unix domain socket.
Parameters:
  • sock (socket) - Unix domain socket to send message through
  • dataList (list of str) - List of strings to send
  • fdList (list of int) - File descriptors to send
Returns: None

recvmsg(sock, dataSize, fdCount=0)

source code 
Receives data and optional file descriptors from a unix domain socket. Returns a (data, fdList) tuple.
Parameters:
  • sock (socket) - Unix domain socket to send message through
  • dataSize (int) - Number of bytes to try to read from the socket.
  • fdCount (int) - Exact number of file descriptors to read from the socket
Returns: tuple

Variables Details [hide private]

errorMessage

Value:
'''
ERROR: An unexpected condition has occurred in Conary.  This is
most likely due to insufficient handling of erroneous input, but
may be some other bug.  In either case, please report the error at
http://issues.rpath.com/ and attach to the issue the file
%(stackfile)s

Then, for more complete information, please run the following script:
...