Example #1
0
def _verify_version(version: str, pyproject_toml_path: Path) -> None:
    gvmtools_version = get_version()
    pyproject_version = get_version_from_pyproject_toml(
        pyproject_toml_path=pyproject_toml_path
    )
    if not is_version_pep440_compliant(gvmtools_version):
        sys.exit(
            "The version in gvmtools/__version__.py is not PEP 440 compliant."
        )

    if pyproject_version != gvmtools_version:
        sys.exit(
            "The version set in the pyproject.toml file \"{}\" doesn't "
            "match the gvm-tools version \"{}\"".format(
                pyproject_version, gvmtools_version
            )
        )

    if version != 'current':
        provided_version = strip_version(version)
        if provided_version != gvmtools_version:
            sys.exit(
                "Provided version \"{}\" does not match the python-gvm "
                "version \"{}\"".format(provided_version, gvmtools_version)
            )

    print('OK')
Example #2
0
def _update_gvm_tools_version(
    new_version: str, pyproject_toml_path: Path, *, force: bool = False
):
    if not pyproject_toml_path.exists():
        sys.exit(
            'Could not find pyproject.toml file in the current working dir.'
        )

    cwd_path = Path.cwd()
    pyproject_version = get_version_from_pyproject_toml(
        pyproject_toml_path=pyproject_toml_path
    )
    version_file_path = cwd_path / 'gvmtools' / '__version__.py'

    if not version_file_path.exists():
        version_file_path.touch()
    elif not force and versions_equal(new_version, get_version()):
        print('Version is already up-to-date.')
        sys.exit(0)

    update_pyproject_version(
        new_version=new_version, pyproject_toml_path=pyproject_toml_path
    )

    update_version_file(
        new_version=new_version, version_file_path=version_file_path,
    )

    print(
        'Updated version from {} to {}'.format(
            pyproject_version, safe_version(new_version)
        )
    )
Example #3
0
from pathlib import Path

from gvm import get_version as get_gvm_version
from gvm.connections import (
    DEFAULT_TIMEOUT,
    SSHConnection,
    TLSConnection,
    UnixSocketConnection,
)

from gvmtools import get_version
from gvmtools.config import Config

logger = logging.getLogger(__name__)

__version__ = get_version()
__api_version__ = get_gvm_version()

DEFAULT_CONFIG_PATH = '~/.config/gvm-tools.conf'

PROTOCOL_OSP = 'OSP'
PROTOCOL_GMP = 'GMP'
DEFAULT_PROTOCOL = PROTOCOL_GMP


class CliParser:
    def __init__(self,
                 description,
                 logfilename,
                 *,
                 prog=None,
Example #4
0
import sys
sys.path.insert(0, os.path.abspath('..'))

import gvmtools

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

project = 'gvm-tools'
copyright = '2018, Greenbone Networks GmbH'
author = 'Greenbone Networks GmbH'

# The short X.Y version

version = '{0}.{1}'.format(gvmtools.VERSION[0], gvmtools.VERSION[1])
# The full version, including alpha/beta/rc tags
release = gvmtools.get_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.autodoc',
    'sphinx.ext.githubpages',
    'sphinxcontrib.napoleon',
]
Example #5
0
# pylint: disable=invalid-name,redefined-builtin,wrong-import-position

import os
import sys

sys.path.insert(0, os.path.abspath('..'))

import gvmtools

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

project = 'gvm-tools'
copyright = '2018-2020, Greenbone Networks GmbH'
author = 'Greenbone Networks GmbH'

version = gvmtools.get_version()
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.autodoc',
    'sphinx.ext.githubpages',
    'sphinx.ext.napoleon',