From 3e66b34acb34b1f05723c9ee844c54d790d8569f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 17 Apr 2020 08:08:26 +0200 Subject: [PATCH 1/5] Add pontos as dev dependency pontos will be used to handle the version information in ospd. --- poetry.lock | 21 +++++++++++++++++---- pyproject.toml | 1 + 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index bbf6d1cc..0498944f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -145,7 +145,6 @@ version = "0.4.3" [[package]] category = "dev" description = "Terminal string styling done right, in Python." -marker = "python_version >= \"3.6\" and python_version < \"4.0\"" name = "colorful" optional = false python-versions = "*" @@ -242,7 +241,6 @@ version = "0.6.1" [[package]] category = "dev" description = "Core utilities for Python packages" -marker = "python_version >= \"3.6\" and python_version < \"4.0\"" name = "packaging" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" @@ -280,6 +278,18 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" version = "0.8.0" +[[package]] +category = "dev" +description = "Common utilities and tools maintained by Greenbone Networks" +name = "pontos" +optional = false +python-versions = ">=3.5,<4.0" +version = "0.2.0" + +[package.dependencies] +packaging = ">=20.3,<21.0" +tomlkit = ">=0.5.11,<0.6.0" + [[package]] category = "main" description = "Cross-platform lib for process and system monitoring in Python." @@ -378,7 +388,6 @@ version = "0.10.0" [[package]] category = "dev" description = "Style preserving TOML library" -marker = "python_version >= \"3.6\" and python_version < \"4.0\"" name = "tomlkit" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" @@ -402,7 +411,7 @@ python-versions = "*" version = "1.11.2" [metadata] -content-hash = "2206289ed35482d352798995c8c4f574a2d161723001239cf546bf270d288f32" +content-hash = "c0f62e52447f312c60bf488e7a1a0a3108d8ea4dd20649565f922a45c5c2bd19" python-versions = "^3.5" [metadata.files] @@ -597,6 +606,10 @@ pathspec = [ {file = "pathspec-0.8.0-py2.py3-none-any.whl", hash = "sha256:7d91249d21749788d07a2d0f94147accd8f845507400749ea19c1ec9054a12b0"}, {file = "pathspec-0.8.0.tar.gz", hash = "sha256:da45173eb3a6f2a5a487efba21f050af2b41948be6ab52b6a1e3ff22bb8b7061"}, ] +pontos = [ + {file = "pontos-0.2.0-py3-none-any.whl", hash = "sha256:6f2778efce3374ab91834845c4ef6176bb455cb2fb3f7653f1518cab7008f65e"}, + {file = "pontos-0.2.0.tar.gz", hash = "sha256:eb94a5af108f99ff32ff63614296835b7343c00fbc7fd6f30c9f78798d2ae217"}, +] psutil = [ {file = "psutil-5.7.0-cp27-none-win32.whl", hash = "sha256:298af2f14b635c3c7118fd9183843f4e73e681bb6f01e12284d4d70d48a60953"}, {file = "psutil-5.7.0-cp27-none-win_amd64.whl", hash = "sha256:75e22717d4dbc7ca529ec5063000b2b294fc9a367f9c9ede1f65846c7955fd38"}, diff --git a/pyproject.toml b/pyproject.toml index 97d2bc54..0936b75b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,6 +52,7 @@ autohooks-plugin-pylint = "^1.2.0" autohooks-plugin-black = {version = "^1.2.0", python = "^3.6"} black = {version = "19.10b0", python = "^3.6"} rope = "^0.16.0" +pontos = "^0.2.0" [tool.black] line-length = 80 From bd0cdb7118ea5c7288825f189471bd56949bf7c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 17 Apr 2020 08:12:36 +0200 Subject: [PATCH 2/5] Add setting for pontos.version Write the version information to ospd/__version__.py file. --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 0936b75b..cc3f3408 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,3 +76,6 @@ exclude = ''' [tool.autohooks] mode = "poetry" pre-commit = ['autohooks.plugins.black', 'autohooks.plugins.pylint'] + +[tool.pontos.version] +version-module-file = "ospd/__version__.py" From 5a80bf8170d241098549f6a96dc05586dc429d5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 17 Apr 2020 08:13:19 +0200 Subject: [PATCH 3/5] Import version information from ospd.__version__ module --- ospd/__init__.py | 2 +- ospd/__version__.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 ospd/__version__.py diff --git a/ospd/__init__.py b/ospd/__init__.py index 7ba3b7e5..d421dd0d 100644 --- a/ospd/__init__.py +++ b/ospd/__init__.py @@ -18,4 +18,4 @@ """ OSPd core module. """ -__version__ = '20.4a1' +from .__version__ import __version__ diff --git a/ospd/__version__.py b/ospd/__version__.py new file mode 100644 index 00000000..231e4c40 --- /dev/null +++ b/ospd/__version__.py @@ -0,0 +1,5 @@ +# pylint: disable=invalid-name + +# THIS IS AN AUTOGENERATED FILE. DO NOT TOUCH! + +__version__ = "20.4a1" From c59032d327d562f3ceba47c2bc5e9f9cab02868f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 17 Apr 2020 08:15:34 +0200 Subject: [PATCH 4/5] Check version information at CircleCI Add a lint check for the version information. This will keep the version information in pyproject.toml and ospd/__version__.py in sync. --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index fccc0e4c..66d7dbd8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -65,6 +65,9 @@ commands: - run: name: Run pylint command: poetry run pylint --score=n --disable=R ospd tests + - run: + name: Check version information + command: poetry run python -m pontos.version verify current jobs: lint-python-files: From 820c6004b3e069a1ead06a08ad282cd6f837eda9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 17 Apr 2020 08:24:05 +0200 Subject: [PATCH 5/5] Add changelog entry about using pontos --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b98f1700..3f6fbcb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Add new get_memory_usage command. [#207](https://github.com/greenbone/ospd/pull/207) - Add lock-file-dir configuration option. [#218](https://github.com/greenbone/ospd/pull/218) - Add details attribute to get_vts command. [#222](https://github.com/greenbone/ospd/pull/222) +- Add [pontos](https://github.com/greenbone/pontos) as dev dependency for + managing the version information in ospd [#254](https://github.com/greenbone/ospd/pull/254) ### Changes - Modify __init__() method and use new syntax for super(). [#186](https://github.com/greenbone/ospd/pull/186)