def _update_python_gvm_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() python_gvm_version = get_version() pyproject_version = get_version_from_pyproject_toml( pyproject_toml_path=pyproject_toml_path) version_file_path = cwd_path / 'gvm' / '__version__.py' if not pyproject_toml_path.exists(): sys.exit('Could not find __version__.py file at {}.'.format( version_file_path)) if not force and versions_equal(new_version, python_gvm_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)))
def main(): if len(sys.argv) < 2: sys.exit('Missing argument for version.') return p_version = strip_version(sys.argv[1]) version = get_version() if p_version != version: sys.exit("Provided version: {} does not match the python-gvm " "version: {}".format(p_version, version))
def _verify_version(version: str, pyproject_toml_path: Path) -> None: python_gvm_version = get_version() pyproject_version = get_version_from_pyproject_toml( pyproject_toml_path=pyproject_toml_path) if not is_version_pep440_compliant(python_gvm_version): sys.exit("The version in gvm/__version__.py is not PEP 440 compliant.") if pyproject_version != python_gvm_version: sys.exit("The version set in the pyproject.toml file \"{}\" doesn't " "match the python-gvm version \"{}\"".format( pyproject_version, python_gvm_version)) if version != 'current': provided_version = strip_version(version) if provided_version != python_gvm_version: sys.exit("Provided version \"{}\" does not match the python-gvm " "version \"{}\"".format(provided_version, python_gvm_version)) print('OK')
sys.path.insert(0, os.path.abspath("..")) import gvm # -- Project information ----------------------------------------------------- project = "python-gvm" copyright = "2018 - 2022, Greenbone Networks GmbH" author = "Greenbone Networks GmbH" # The short X.Y version version = f"{gvm.__version__[0]}.{gvm.__version__[1]}" # The full version, including alpha/beta/rc tags release = gvm.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", "sphinx.ext.napoleon", ]
from setuptools import setup, find_packages __here__ = Path(__file__).parent.resolve() sys.path.insert(0, str(__here__)) from gvm import get_version with (__here__ / "README.md").open("r") as f: long_description = f.read() setup( name='python-gvm', version=get_version(), author='Greenbone Networks GmbH', author_email='*****@*****.**', description='Library to communicate with remote servers over GMP or OSP', long_description=long_description, long_description_content_type='text/markdown', url='https://github.com/greenbone/python-gvm', packages=find_packages(), install_requires=['paramiko', 'lxml', 'defusedxml'], python_requires='>=3.5', classifiers=[ # Full list: https://pypi.org/pypi?%3Aaction=list_classifiers 'Development Status :: 5 - Production/Stable', 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', 'Environment :: Console', 'Intended Audience :: Developers',