How to use the gcovr.version.__version__ function in gcovr

To help you get started, we’ve selected a few gcovr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gcovr / gcovr / gcovr / __main__.py View on Github external
with io.open(cfg_name, encoding='UTF-8') as cfg_file:
            cfg_options = parse_config_into_dict(
                parse_config_file(cfg_file, filename=cfg_name))

    options_dict = merge_options_and_set_defaults(
        [cfg_options, cli_options.__dict__])
    options = Options(**options_dict)

    logger = Logger(options.verbose)

    if cli_options.version:
        logger.msg(
            "gcovr {version}\n"
            "\n"
            "{copyright}",
            version=__version__, copyright=COPYRIGHT)
        sys.exit(0)

    if options.html_medium_threshold > options.html_high_threshold:
        logger.error(
            "value of --html-medium-threshold={} should be\n"
            "lower than or equal to the value of --html-high-threshold={}.",
            options.html_medium_threshold, options.html_high_threshold)
        sys.exit(1)

    if options.output is not None:
        options.output = os.path.abspath(options.output)

    if options.objdir is not None:
        if not options.objdir:
            logger.error(
                "empty --object-directory option.\n"
github gcovr / gcovr / doc / source / conf.py View on Github external
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join('..', '..')))
import gcovr.version # noqa

# -- Project information -----------------------------------------------------

project = u'gcovr'
copyright = u'2018, the gcovr authors'
author = u'the gcovr authors'

# The short X.Y version
version = gcovr.version.__version__
# The full version, including alpha/beta/rc tags
release = version


# -- General configuration ---------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
    'sphinx.ext.todo',
    'sphinx.ext.extlinks',
github gcovr / gcovr / gcovr / html_generator.py View on Github external
def print_html_report(covdata, output_file, options):
    medium_threshold = options.html_medium_threshold
    high_threshold = options.html_high_threshold
    details = options.html_details
    if output_file is None:
        details = False
    data = {}
    data['HEAD'] = options.html_title
    data['VERSION'] = __version__
    data['TIME'] = str(int(time.time()))
    data['DATE'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    data['ROWS'] = []
    data['ENC'] = options.html_encoding
    data['low_color'] = low_color
    data['medium_color'] = medium_color
    data['high_color'] = high_color
    data['COVERAGE_MED'] = medium_threshold
    data['COVERAGE_HIGH'] = high_threshold
    data['CSS'] = templates().get_template('style.css').render(
        low_color=low_color,
        medium_color=medium_color,
        high_color=high_color,
        covered_color=covered_color,
        uncovered_color=uncovered_color,
        takenBranch_color=takenBranch_color,
github gcovr / gcovr / gcovr / cobertura_xml_generator.py View on Github external
"lines-valid", str(lineTotal)
    )
    root.set(
        "branches-covered", str(branchCovered)
    )
    root.set(
        "branches-valid", str(branchTotal)
    )
    root.set(
        "complexity", "0.0"
    )
    root.set(
        "timestamp", str(int(time.time()))
    )
    root.set(
        "version", "gcovr %s" % (__version__,)
    )

    # Generate the  element: this is either the root directory
    # (specified by --root), or the CWD.
    # sources = doc.createElement("sources")
    sources = etree.SubElement(root, "sources")

    # Generate the coverage output (on a per-package basis)
    # packageXml = doc.createElement("packages")
    packageXml = etree.SubElement(root, "packages")
    packages = {}

    for f in sorted(covdata):
        data = covdata[f]
        filename = presentable_filename(f, root_filter=options.root_filter)
        if '/' in filename: