Did I find the right examples for you? yes no

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)

        def get_git_version(module_file, abbrev=4):
    # Read in the version that's currently in RELEASE-VERSION.
    release_version = read_release_version(module_file)

    # First try to get the current version using “git describe”.
    cwd = getcwd()
    version_dir, version_file = _lookup_version(module_file)
    git_version = None
    try:
        chdir(version_dir)
        git_version = call_git_describe(abbrev)
    finally:
        chdir(cwd)

    # Extract version number
    version = None
    if git_version:
        m = version_pattern.match(git_version)
        if m:
            version = m.group('version')

    # If that doesn't work, fall back on the value that's in
    # RELEASE-VERSION.

    if version is None:
        version = release_version

    # If we still don't have anything, that's an error.

    if version is None:
        raise ValueError((
            "Cannot find the version number! Looking "
            "in %s while in %s: %s"), version_dir, cwd)

    # If the current version is different from what's in the
    # RELEASE-VERSION file, update the file to be current.

    if version != release_version:
        write_release_version(module_file, version)

    # Finally, return the current version.

    return version
        


src/y/a/yaclifw-0.0.3/setup.py   yaclifw(Download)
 
from setuptools import setup
from yaclifw.version import get_git_version
 
from setuptools.command.test import test as TestCommand
 
from yaclifw import __file__ as module_file
VERSION = get_git_version(module_file)
ZIP_SAFE = False