src/cm/utils/system.py
author Simon Descarpentries <sid1@sopinspace.com>
Fri, 05 Aug 2011 17:12:15 +0200
changeset 373 f6fe14eb51bc
parent 0 40c8f766c9b8
permissions -rw-r--r--
Add a title attribute on comment scopes to indicate the number of comments in the scope. Also ensure that the last c-count-x defined color class is set even if there are more than 25 comments in the scope.

# taken from plone

import os

bin_search_path = [
    '/usr/bin',
    '/usr/local/bin',
    ]

class MissingBinary(Exception): pass

def bin_search(binary):
    """search the bin_search_path  for a given binary
    returning its fullname or None"""
    result = None
    mode   = os.R_OK | os.X_OK
    for p in bin_search_path:
        path = os.path.join(p, binary)
        if os.access(path, mode) == 1:
            result = path
            break
    else:
        raise MissingBinary('Unable to find binary "%s"' % binary)
    return result