def call_git_describe(abbrev=4):
    dot_git = os.path.join(
        os.path.dirname(os.path.abspath(__file__)),
        '.git')
    if not os.path.exists(dot_git):
        return None, None

    line = None
    p = None
    try:
        p = Popen(['git', 'describe', '--abbrev=%d' % abbrev],
                  stdout=PIPE, stderr=PIPE, 
                  cwd=os.path.dirname(os.path.abspath(__file__)))
        p.stderr.close()
        describe_line = p.stdout.readlines()[0].strip()

        p = Popen(['git', 'rev-parse', 'HEAD'],
                  stdout=PIPE, stderr=PIPE)
        p.stderr.close()
        source_hash = p.stdout.readlines()[0].strip()
        source_hash = source_hash[:abbrev]

        parts = describe_line.split('-')
        if len(parts) == 1:
            version = parts[0]

        else:
            ver, rel, source_hash = parts
            version_parts = ver.split('.')
            lasti = 1 - len(version_parts)
            # increment whatever the last part of this a.b.c.d.yadda
            version_parts[lasti] = str(int(version_parts[lasti]) + 1)
            version = '{}.dev{}'.format('.'.join(version_parts), rel)

        return version, source_hash
 
    except Exception, exc:
        sys.stderr.write('line: %r\n' % line)
        sys.stderr.write(traceback.format_exc(exc))
        try:
            sys.stderr.write('p.stderr.read()=%s\n' % p.stderr.read())
        except Exception, exc:
            sys.stderr.write(traceback.format_exc(exc))
        try:
            sys.stderr.write('os.getcwd()=%s\n' % os.getcwd())
        except Exception, exc:
            sys.stderr.write(traceback.format_exc(exc))
        return None, None
dataset/ETHPy150Open accumulo/pyaccumulo/version.py/call_git_describe/swapped operands of `-`