Пример #1
0
def checkRevision(rev,comp='>='):
    """Check that we have the requested revision number.

    Raises an error if the revision number of the running pyFormex does not
    pass the comparison test with the given revision number.

    rev: a positive integer.
    comp: a string used in the comparison.

    Default is to allow the specified revision and all later ones.
    """
    try:
        cur = int(utils.splitStartDigits(pf.__revision__.split()[1])[0])
        if not eval("%s %s %s" % (cur,comp,rev)):
            raise RuntimeError
    except:
        raise RuntimeError,"Your current pyFormex revision (%s) does not pass the test %s %s" % (pf.__revision__,comp,rev)
Пример #2
0
def checkRevision(rev, comp='>='):
    """Check the pyFormex revision number.

    - rev: a positive integer.
    - comp: a string specifying a comparison operator.

    By default, this function returns True if the pyFormex revision
    number is equal or larger than the specified number.

    The comp argument may specify another comparison operator.

    If pyFormex is unable to find its revision number (this is the
    case on very old versions) the test returns False.
    """
    try:
        cur = int(utils.splitStartDigits(pf.__revision__)[0])
        return eval("%s %s %s" % (cur, comp, rev))
    except:
        return False
Пример #3
0
def checkRevision(rev,comp='>='):
    """Check the pyFormex revision number.

    - rev: a positive integer.
    - comp: a string specifying a comparison operator.

    By default, this function returns True if the pyFormex revision
    number is equal or larger than the specified number.

    The comp argument may specify another comparison operator.

    If pyFormex is unable to find its revision number (this is the
    case on very old versions) the test returns False.
    """
    try:
        cur = int(utils.splitStartDigits(pf.__revision__)[0])
        return eval("%s %s %s" % (cur,comp,rev))
    except:
        return False