version-query 1.5.2__tar.gz → 1.5.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {version-query-1.5.2 → version_query-1.5.5}/NOTICE +1 -1
- {version-query-1.5.2/version_query.egg-info → version_query-1.5.5}/PKG-INFO +12 -7
- {version-query-1.5.2 → version_query-1.5.5}/README.rst +1 -1
- {version-query-1.5.2 → version_query-1.5.5}/pyproject.toml +1 -1
- version_query-1.5.5/requirements.txt +4 -0
- version_query-1.5.5/requirements_test.txt +3 -0
- {version-query-1.5.2 → version_query-1.5.5}/setup.py +4 -3
- version_query-1.5.5/test/__init__.py +14 -0
- {version-query-1.5.2 → version_query-1.5.5}/test/examples.py +13 -14
- {version-query-1.5.2 → version_query-1.5.5}/test/test_git.py +14 -8
- {version-query-1.5.2 → version_query-1.5.5}/test/test_query.py +11 -10
- version_query-1.5.5/version_query/__main__.py +19 -0
- {version-query-1.5.2 → version_query-1.5.5}/version_query/main.py +6 -11
- {version-query-1.5.2 → version_query-1.5.5/version_query.egg-info}/PKG-INFO +12 -7
- {version-query-1.5.2 → version_query-1.5.5}/version_query.egg-info/SOURCES.txt +0 -2
- version_query-1.5.5/version_query.egg-info/requires.txt +4 -0
- version-query-1.5.2/requirements.txt +0 -3
- version-query-1.5.2/requirements_test.txt +0 -4
- version-query-1.5.2/test/__init__.py +0 -19
- version-query-1.5.2/test/test_with_git_repo.py +0 -108
- version-query-1.5.2/version_query/__main__.py +0 -7
- version-query-1.5.2/version_query.egg-info/requires.txt +0 -3
- {version-query-1.5.2 → version_query-1.5.5}/LICENSE +0 -0
- {version-query-1.5.2 → version_query-1.5.5}/MANIFEST.in +0 -0
- {version-query-1.5.2 → version_query-1.5.5}/setup.cfg +0 -0
- {version-query-1.5.2 → version_query-1.5.5}/test/test_packaging.py +0 -0
- {version-query-1.5.2 → version_query-1.5.5}/test/test_version.py +0 -0
- {version-query-1.5.2 → version_query-1.5.5}/version_query/__init__.py +0 -0
- {version-query-1.5.2 → version_query-1.5.5}/version_query/_version.py +0 -0
- {version-query-1.5.2 → version_query-1.5.5}/version_query/git_query.py +0 -0
- {version-query-1.5.2 → version_query-1.5.5}/version_query/py.typed +0 -0
- {version-query-1.5.2 → version_query-1.5.5}/version_query/py_query.py +0 -0
- {version-query-1.5.2 → version_query-1.5.5}/version_query/query.py +0 -0
- {version-query-1.5.2 → version_query-1.5.5}/version_query/version.py +0 -0
- {version-query-1.5.2 → version_query-1.5.5}/version_query.egg-info/dependency_links.txt +0 -0
- {version-query-1.5.2 → version_query-1.5.5}/version_query.egg-info/top_level.txt +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
version-query
|
|
2
|
-
Copyright (c) 2017-
|
|
2
|
+
Copyright (c) 2017-2024 Mateusz Bysiek https://mbdevpl.github.io/
|
|
3
3
|
Copyright (c) 2020 John Vandenberg https://github.com/jayvdb
|
|
4
4
|
|
|
5
5
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: version-query
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.5
|
|
4
4
|
Summary: Zero-overhead package versioning for Python.
|
|
5
5
|
Home-page: https://github.com/mbdevpl/version-query
|
|
6
6
|
Download-URL:
|
|
@@ -9,19 +9,20 @@ Author-email: mateusz.bysiek@gmail.com
|
|
|
9
9
|
Maintainer: Mateusz Bysiek
|
|
10
10
|
Maintainer-email: mateusz.bysiek@gmail.com
|
|
11
11
|
License: Apache License 2.0
|
|
12
|
-
Keywords: automation,
|
|
12
|
+
Keywords: automation,continuous integration,git,releasing,semantic versioning,tagging,versioning
|
|
13
13
|
Classifier: Development Status :: 5 - Production/Stable
|
|
14
14
|
Classifier: Environment :: Console
|
|
15
15
|
Classifier: Intended Audience :: Developers
|
|
16
16
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
17
|
Classifier: Natural Language :: English
|
|
18
|
-
Classifier: Operating System :: MacOS
|
|
18
|
+
Classifier: Operating System :: MacOS
|
|
19
19
|
Classifier: Operating System :: Microsoft :: Windows
|
|
20
20
|
Classifier: Operating System :: POSIX :: Linux
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.8
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.9
|
|
23
23
|
Classifier: Programming Language :: Python :: 3.10
|
|
24
24
|
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
26
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
26
27
|
Classifier: Topic :: Software Development :: Version Control
|
|
27
28
|
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
@@ -32,6 +33,10 @@ Requires-Python: >=3.8
|
|
|
32
33
|
Description-Content-Type: text/x-rst; charset=UTF-8
|
|
33
34
|
License-File: LICENSE
|
|
34
35
|
License-File: NOTICE
|
|
36
|
+
Requires-Dist: boilerplates[cli,logging]~=1.0
|
|
37
|
+
Requires-Dist: GitPython~=3.1
|
|
38
|
+
Requires-Dist: packaging>=23.0
|
|
39
|
+
Requires-Dist: semver<3.1,>=2.13
|
|
35
40
|
|
|
36
41
|
.. role:: bash(code)
|
|
37
42
|
:language: bash
|
|
@@ -63,7 +68,7 @@ Zero-overhead package versioning for Python.
|
|
|
63
68
|
:alt: grade from Codacy
|
|
64
69
|
|
|
65
70
|
.. image:: https://img.shields.io/github/license/mbdevpl/version-query.svg
|
|
66
|
-
:target: https://github.com/mbdevpl/version-query/blob/v1.5.
|
|
71
|
+
:target: https://github.com/mbdevpl/version-query/blob/v1.5.5/NOTICE
|
|
67
72
|
:alt: license
|
|
68
73
|
|
|
69
74
|
Package versioning toolkit for Python which relies on git tags, git history traversal
|
|
@@ -473,8 +478,8 @@ Requirements
|
|
|
473
478
|
|
|
474
479
|
Python version 3.8 or later.
|
|
475
480
|
|
|
476
|
-
Python libraries as specified in `requirements.txt <https://github.com/mbdevpl/version-query/blob/v1.5.
|
|
481
|
+
Python libraries as specified in `requirements.txt <https://github.com/mbdevpl/version-query/blob/v1.5.5/requirements.txt>`_.
|
|
477
482
|
|
|
478
|
-
Building and running tests additionally requires packages listed in `requirements_test.txt <https://github.com/mbdevpl/version-query/blob/v1.5.
|
|
483
|
+
Building and running tests additionally requires packages listed in `requirements_test.txt <https://github.com/mbdevpl/version-query/blob/v1.5.5/requirements_test.txt>`_.
|
|
479
484
|
|
|
480
|
-
Tested on Linux,
|
|
485
|
+
Tested on Linux, macOS and Windows.
|
|
@@ -17,13 +17,14 @@ class Package(boilerplates.setup.Package):
|
|
|
17
17
|
'Intended Audience :: Developers',
|
|
18
18
|
'License :: OSI Approved :: Apache Software License',
|
|
19
19
|
'Natural Language :: English',
|
|
20
|
-
'Operating System :: MacOS
|
|
20
|
+
'Operating System :: MacOS',
|
|
21
21
|
'Operating System :: Microsoft :: Windows',
|
|
22
22
|
'Operating System :: POSIX :: Linux',
|
|
23
23
|
'Programming Language :: Python :: 3.8',
|
|
24
24
|
'Programming Language :: Python :: 3.9',
|
|
25
25
|
'Programming Language :: Python :: 3.10',
|
|
26
26
|
'Programming Language :: Python :: 3.11',
|
|
27
|
+
'Programming Language :: Python :: 3.12',
|
|
27
28
|
'Programming Language :: Python :: 3 :: Only',
|
|
28
29
|
'Topic :: Software Development :: Version Control',
|
|
29
30
|
'Topic :: Software Development :: Version Control :: Git',
|
|
@@ -31,8 +32,8 @@ class Package(boilerplates.setup.Package):
|
|
|
31
32
|
'Topic :: Utilities',
|
|
32
33
|
'Typing :: Typed']
|
|
33
34
|
keywords = [
|
|
34
|
-
'automation', '
|
|
35
|
-
'versioning']
|
|
35
|
+
'automation', 'continuous integration', 'git', 'releasing', 'semantic versioning',
|
|
36
|
+
'tagging', 'versioning']
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
if __name__ == '__main__':
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Initialization of tests of version_query package."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
from version_query.__main__ import Logging
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class TestsLogging(Logging):
|
|
9
|
+
"""Logging configuration."""
|
|
10
|
+
|
|
11
|
+
level_global = logging.DEBUG
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
TestsLogging.configure()
|
|
@@ -11,26 +11,25 @@ from version_query.version import VersionComponent
|
|
|
11
11
|
|
|
12
12
|
_HERE = pathlib.Path(__file__).resolve().parent
|
|
13
13
|
|
|
14
|
-
_GIT_REPOS_ROOT = pathlib.Path(os.environ
|
|
14
|
+
_GIT_REPOS_ROOT = pathlib.Path(os.environ.get('EXAMPLE_PROJECTS_PATH', '..')).resolve()
|
|
15
15
|
|
|
16
16
|
GIT_REPO_EXAMPLES = list(_ for _ in _GIT_REPOS_ROOT.glob('**/.git') if _.is_dir())
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def python_lib_dir() -> pathlib.Path:
|
|
20
|
-
"""Get root folder of currently running Python libraries.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if platform.python_implementation() == 'CPython':
|
|
26
|
-
lib_dir_parts.append('lib')
|
|
27
|
-
if platform.system() != 'Windows':
|
|
28
|
-
lib_dir_parts.append('python{}.{}'.format(*sys.version_info[:2]))
|
|
20
|
+
"""Get root folder of currently running Python libraries."""
|
|
21
|
+
lib_dir = pathlib.Path(getattr(sys, 'real_prefix', sys.prefix))
|
|
22
|
+
assert lib_dir.is_dir(), lib_dir
|
|
23
|
+
if platform.system() == 'Windows':
|
|
24
|
+
lib_dir /= 'Lib'
|
|
29
25
|
else:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
# currently implemented only for CPython and PyPy
|
|
27
|
+
implementation_dir_prefix = {
|
|
28
|
+
'CPython': 'python',
|
|
29
|
+
'PyPy': 'pypy'}.get(platform.python_implementation())
|
|
30
|
+
lib_dir /= 'lib'
|
|
31
|
+
assert lib_dir.is_dir(), lib_dir
|
|
32
|
+
lib_dir /= f'{implementation_dir_prefix}{sys.version_info[0]}.{sys.version_info[1]}'
|
|
34
33
|
assert lib_dir.is_dir(), lib_dir
|
|
35
34
|
return lib_dir
|
|
36
35
|
|
|
@@ -2,18 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
import itertools
|
|
4
4
|
import logging
|
|
5
|
-
|
|
5
|
+
import platform
|
|
6
|
+
import unittest
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
import boilerplates.git_repo_tests
|
|
9
|
+
import git
|
|
8
10
|
|
|
9
11
|
from version_query.version import VersionComponent, Version
|
|
10
12
|
from version_query.git_query import query_git_repo, predict_git_repo
|
|
11
|
-
from .test_with_git_repo import GitRepoTests
|
|
12
13
|
|
|
13
14
|
_LOG = logging.getLogger(__name__)
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
@unittest.skipIf(
|
|
18
|
+
platform.system() == 'Windows' and platform.python_implementation() == 'PyPy',
|
|
19
|
+
'skipping as these tests fail on Windows with PyPy')
|
|
20
|
+
class Tests(boilerplates.git_repo_tests.GitRepoTests):
|
|
17
21
|
"""Test suite for automated tests of generated git repositories.
|
|
18
22
|
|
|
19
23
|
Each case is executed in a fresh empty repository.
|
|
@@ -21,6 +25,8 @@ class Tests(GitRepoTests):
|
|
|
21
25
|
|
|
22
26
|
def setUp(self):
|
|
23
27
|
super().setUp()
|
|
28
|
+
self.default_branch_name = git.GitConfigParser(
|
|
29
|
+
read_only=True).get_value('init', 'defaultBranch', default='master')
|
|
24
30
|
self.git_init()
|
|
25
31
|
|
|
26
32
|
def test_empty_repo(self):
|
|
@@ -96,7 +102,7 @@ class Tests(GitRepoTests):
|
|
|
96
102
|
self.repo.git.checkout('devel')
|
|
97
103
|
self.git_commit_new_file()
|
|
98
104
|
self.repo.create_tag('error')
|
|
99
|
-
self.repo.git.checkout(
|
|
105
|
+
self.repo.git.checkout(self.default_branch_name)
|
|
100
106
|
self.repo.git.merge('devel')
|
|
101
107
|
self.repo.git.merge('experimental')
|
|
102
108
|
self.git_commit_new_file()
|
|
@@ -153,7 +159,7 @@ class Tests(GitRepoTests):
|
|
|
153
159
|
self.git_commit_new_file()
|
|
154
160
|
self.repo.create_tag('v0.2.0')
|
|
155
161
|
self.git_commit_new_file()
|
|
156
|
-
self.repo.git.checkout(
|
|
162
|
+
self.repo.git.checkout(self.default_branch_name)
|
|
157
163
|
current_version = query_git_repo(self.repo_path)
|
|
158
164
|
self.assertEqual(current_version.to_str(), '0.1.0')
|
|
159
165
|
upcoming_version = predict_git_repo(self.repo_path)
|
|
@@ -176,7 +182,7 @@ class Tests(GitRepoTests):
|
|
|
176
182
|
self.git_commit_new_file()
|
|
177
183
|
self.repo.create_tag('v0.1.0')
|
|
178
184
|
self.git_commit_new_file()
|
|
179
|
-
self.repo.git.checkout(
|
|
185
|
+
self.repo.git.checkout(self.default_branch_name)
|
|
180
186
|
self.repo.git.merge('devel')
|
|
181
187
|
self.git_commit_new_file()
|
|
182
188
|
current_version = query_git_repo(self.repo_path)
|
|
@@ -191,7 +197,7 @@ class Tests(GitRepoTests):
|
|
|
191
197
|
self.repo.git.checkout('devel')
|
|
192
198
|
self.git_commit_new_file()
|
|
193
199
|
self.repo.create_tag('v1.0.0')
|
|
194
|
-
self.repo.git.checkout(
|
|
200
|
+
self.repo.git.checkout(self.default_branch_name)
|
|
195
201
|
self.repo.git.merge('devel')
|
|
196
202
|
current_version = query_git_repo(self.repo_path)
|
|
197
203
|
self.assertEqual(current_version.to_str(), '1.0.0')
|
|
@@ -9,6 +9,7 @@ import pathlib
|
|
|
9
9
|
import sys
|
|
10
10
|
import tempfile
|
|
11
11
|
import unittest
|
|
12
|
+
import unittest.mock
|
|
12
13
|
|
|
13
14
|
from boilerplates.packaging_tests import run_module
|
|
14
15
|
|
|
@@ -184,12 +185,12 @@ class Tests(unittest.TestCase):
|
|
|
184
185
|
_LOG.info('%s', sio.getvalue())
|
|
185
186
|
|
|
186
187
|
def test_here(self):
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
with
|
|
188
|
+
with temporarily_set_logger_level('version_query', logging.INFO):
|
|
189
|
+
sio = io.StringIO()
|
|
190
|
+
with contextlib.redirect_stdout(sio):
|
|
190
191
|
run_module('version_query', '.')
|
|
191
|
-
|
|
192
|
-
|
|
192
|
+
self.assertEqual(sio.getvalue().rstrip(), query_caller().to_str())
|
|
193
|
+
self.assertEqual(sio.getvalue().rstrip(), query_version_str())
|
|
193
194
|
|
|
194
195
|
def test_increment_here(self):
|
|
195
196
|
sio = io.StringIO()
|
|
@@ -200,9 +201,9 @@ class Tests(unittest.TestCase):
|
|
|
200
201
|
query_caller().increment(VersionComponent.Patch).to_str())
|
|
201
202
|
|
|
202
203
|
def test_predict_here(self):
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
with
|
|
204
|
+
with temporarily_set_logger_level('version_query', logging.INFO):
|
|
205
|
+
sio = io.StringIO()
|
|
206
|
+
with contextlib.redirect_stdout(sio):
|
|
206
207
|
run_module('version_query', '-p', '.')
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
self.assertEqual(sio.getvalue().rstrip(), predict_caller().to_str())
|
|
209
|
+
self.assertEqual(sio.getvalue().rstrip(), predict_version_str())
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Entry point of the command-line interface of version_query package."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
import boilerplates.logging
|
|
6
|
+
|
|
7
|
+
from .main import main
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Logging(boilerplates.logging.Logging):
|
|
11
|
+
"""Logging configuration."""
|
|
12
|
+
|
|
13
|
+
packages = ['version_query']
|
|
14
|
+
level_global = logging.INFO
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
if __name__ == '__main__':
|
|
18
|
+
Logging.configure()
|
|
19
|
+
main()
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"""Command-line interface of version_query package."""
|
|
2
2
|
|
|
3
3
|
import argparse
|
|
4
|
-
import logging
|
|
5
|
-
import os
|
|
6
4
|
import pathlib
|
|
7
|
-
|
|
5
|
+
|
|
6
|
+
from boilerplates.cli import make_copyright_notice, add_version_option
|
|
8
7
|
|
|
9
8
|
from ._version import VERSION
|
|
10
9
|
from .version import VersionComponent
|
|
@@ -16,25 +15,21 @@ def main(args=None, namespace=None) -> None:
|
|
|
16
15
|
|
|
17
16
|
Either query or predict version in a given folder according to the arguments.
|
|
18
17
|
"""
|
|
19
|
-
logging_level = getattr(logging, os.environ.get('LOGGING_LEVEL', 'warning').upper())
|
|
20
|
-
logging.basicConfig(level=min(logging_level, logging.WARNING))
|
|
21
|
-
logging.getLogger().setLevel(logging.WARNING)
|
|
22
|
-
logging.getLogger('version_query').setLevel(logging_level)
|
|
23
18
|
parser = argparse.ArgumentParser(
|
|
24
19
|
prog='version_query',
|
|
25
20
|
description='''Tool for querying current versions of Python packages. Use LOGGING_LEVEL
|
|
26
21
|
environment variable to adjust logging level.''',
|
|
27
|
-
epilog=
|
|
28
|
-
|
|
22
|
+
epilog=make_copyright_notice(
|
|
23
|
+
2017, 2024, author='the contributors', url='https://github.com/mbdevpl/version-query'),
|
|
29
24
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
|
25
|
+
add_version_option(parser, VERSION)
|
|
26
|
+
|
|
30
27
|
parser.add_argument('-i', '--increment', action='store_true', help='''output version string for
|
|
31
28
|
next patch release, i.e. if version is 1.0.3, output 1.0.4''')
|
|
32
29
|
parser.add_argument('-p', '--predict', action='store_true', help='''operate in prediction mode,
|
|
33
30
|
i.e. assume existence of git repository and infer current version from
|
|
34
31
|
its tags, history and working tree status''')
|
|
35
32
|
parser.add_argument('path', type=pathlib.Path)
|
|
36
|
-
parser.add_argument('--version', action='version',
|
|
37
|
-
version=f'{parser.prog} {VERSION},\nPython {sys.version}')
|
|
38
33
|
parsed_args = parser.parse_args(args=args, namespace=namespace)
|
|
39
34
|
if parsed_args.predict and parsed_args.increment:
|
|
40
35
|
raise ValueError(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: version-query
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.5
|
|
4
4
|
Summary: Zero-overhead package versioning for Python.
|
|
5
5
|
Home-page: https://github.com/mbdevpl/version-query
|
|
6
6
|
Download-URL:
|
|
@@ -9,19 +9,20 @@ Author-email: mateusz.bysiek@gmail.com
|
|
|
9
9
|
Maintainer: Mateusz Bysiek
|
|
10
10
|
Maintainer-email: mateusz.bysiek@gmail.com
|
|
11
11
|
License: Apache License 2.0
|
|
12
|
-
Keywords: automation,
|
|
12
|
+
Keywords: automation,continuous integration,git,releasing,semantic versioning,tagging,versioning
|
|
13
13
|
Classifier: Development Status :: 5 - Production/Stable
|
|
14
14
|
Classifier: Environment :: Console
|
|
15
15
|
Classifier: Intended Audience :: Developers
|
|
16
16
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
17
|
Classifier: Natural Language :: English
|
|
18
|
-
Classifier: Operating System :: MacOS
|
|
18
|
+
Classifier: Operating System :: MacOS
|
|
19
19
|
Classifier: Operating System :: Microsoft :: Windows
|
|
20
20
|
Classifier: Operating System :: POSIX :: Linux
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.8
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.9
|
|
23
23
|
Classifier: Programming Language :: Python :: 3.10
|
|
24
24
|
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
26
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
26
27
|
Classifier: Topic :: Software Development :: Version Control
|
|
27
28
|
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
@@ -32,6 +33,10 @@ Requires-Python: >=3.8
|
|
|
32
33
|
Description-Content-Type: text/x-rst; charset=UTF-8
|
|
33
34
|
License-File: LICENSE
|
|
34
35
|
License-File: NOTICE
|
|
36
|
+
Requires-Dist: boilerplates[cli,logging]~=1.0
|
|
37
|
+
Requires-Dist: GitPython~=3.1
|
|
38
|
+
Requires-Dist: packaging>=23.0
|
|
39
|
+
Requires-Dist: semver<3.1,>=2.13
|
|
35
40
|
|
|
36
41
|
.. role:: bash(code)
|
|
37
42
|
:language: bash
|
|
@@ -63,7 +68,7 @@ Zero-overhead package versioning for Python.
|
|
|
63
68
|
:alt: grade from Codacy
|
|
64
69
|
|
|
65
70
|
.. image:: https://img.shields.io/github/license/mbdevpl/version-query.svg
|
|
66
|
-
:target: https://github.com/mbdevpl/version-query/blob/v1.5.
|
|
71
|
+
:target: https://github.com/mbdevpl/version-query/blob/v1.5.5/NOTICE
|
|
67
72
|
:alt: license
|
|
68
73
|
|
|
69
74
|
Package versioning toolkit for Python which relies on git tags, git history traversal
|
|
@@ -473,8 +478,8 @@ Requirements
|
|
|
473
478
|
|
|
474
479
|
Python version 3.8 or later.
|
|
475
480
|
|
|
476
|
-
Python libraries as specified in `requirements.txt <https://github.com/mbdevpl/version-query/blob/v1.5.
|
|
481
|
+
Python libraries as specified in `requirements.txt <https://github.com/mbdevpl/version-query/blob/v1.5.5/requirements.txt>`_.
|
|
477
482
|
|
|
478
|
-
Building and running tests additionally requires packages listed in `requirements_test.txt <https://github.com/mbdevpl/version-query/blob/v1.5.
|
|
483
|
+
Building and running tests additionally requires packages listed in `requirements_test.txt <https://github.com/mbdevpl/version-query/blob/v1.5.5/requirements_test.txt>`_.
|
|
479
484
|
|
|
480
|
-
Tested on Linux,
|
|
485
|
+
Tested on Linux, macOS and Windows.
|
|
@@ -12,7 +12,6 @@ setup.py
|
|
|
12
12
|
./test/test_packaging.py
|
|
13
13
|
./test/test_query.py
|
|
14
14
|
./test/test_version.py
|
|
15
|
-
./test/test_with_git_repo.py
|
|
16
15
|
./version_query/__init__.py
|
|
17
16
|
./version_query/__main__.py
|
|
18
17
|
./version_query/_version.py
|
|
@@ -27,7 +26,6 @@ test/test_git.py
|
|
|
27
26
|
test/test_packaging.py
|
|
28
27
|
test/test_query.py
|
|
29
28
|
test/test_version.py
|
|
30
|
-
test/test_with_git_repo.py
|
|
31
29
|
version_query.egg-info/PKG-INFO
|
|
32
30
|
version_query.egg-info/SOURCES.txt
|
|
33
31
|
version_query.egg-info/dependency_links.txt
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"""Initialization of tests of version_query package."""
|
|
2
|
-
|
|
3
|
-
import logging
|
|
4
|
-
import os
|
|
5
|
-
|
|
6
|
-
import colorlog
|
|
7
|
-
|
|
8
|
-
_HANDLER = logging.StreamHandler()
|
|
9
|
-
_HANDLER.setFormatter(colorlog.ColoredFormatter(
|
|
10
|
-
'{name} [{log_color}{levelname}{reset}] {message}', style='{'))
|
|
11
|
-
|
|
12
|
-
logging.basicConfig(level=logging.DEBUG, handlers=[_HANDLER])
|
|
13
|
-
logging.getLogger().setLevel(logging.WARNING)
|
|
14
|
-
logging.getLogger('version_query').setLevel(
|
|
15
|
-
getattr(logging, os.environ.get('LOGGING_LEVEL', 'debug').upper()))
|
|
16
|
-
logging.getLogger('test').setLevel(logging.DEBUG)
|
|
17
|
-
|
|
18
|
-
if 'EXAMPLE_PROJECTS_PATH' not in os.environ:
|
|
19
|
-
os.environ['EXAMPLE_PROJECTS_PATH'] = '..'
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"""Perform tests on and in synthetic git repositories."""
|
|
2
|
-
|
|
3
|
-
import logging
|
|
4
|
-
import pathlib
|
|
5
|
-
import platform
|
|
6
|
-
import tempfile
|
|
7
|
-
import unittest
|
|
8
|
-
|
|
9
|
-
import git
|
|
10
|
-
|
|
11
|
-
_LOG = logging.getLogger(__name__)
|
|
12
|
-
|
|
13
|
-
__version__ = '2022.08.18'
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class GitRepoTests(unittest.TestCase):
|
|
17
|
-
"""Provide several utility propertied and methods named repo_* and git_*."""
|
|
18
|
-
|
|
19
|
-
repo = None # type: git.Repo
|
|
20
|
-
repo_path = None # type: pathlib.Path
|
|
21
|
-
|
|
22
|
-
def setUp(self):
|
|
23
|
-
self._tmpdir = tempfile.TemporaryDirectory() # pylint: disable=consider-using-with
|
|
24
|
-
self.repo_path = pathlib.Path(self._tmpdir.name)
|
|
25
|
-
self.assertTrue(self.repo_path.is_dir())
|
|
26
|
-
self.repo = None
|
|
27
|
-
self._repo_files = []
|
|
28
|
-
|
|
29
|
-
def tearDown(self):
|
|
30
|
-
for path in self._repo_files:
|
|
31
|
-
if path.is_file():
|
|
32
|
-
path.unlink()
|
|
33
|
-
if self.repo is not None:
|
|
34
|
-
self.assertIsInstance(self.repo, git.Repo)
|
|
35
|
-
self.repo.close()
|
|
36
|
-
self.repo = None
|
|
37
|
-
if platform.system() != 'Windows':
|
|
38
|
-
self._tmpdir.cleanup()
|
|
39
|
-
self._tmpdir = None
|
|
40
|
-
|
|
41
|
-
@property
|
|
42
|
-
def repo_head_hexsha(self) -> str:
|
|
43
|
-
return self.repo.head.commit.hexsha[:8]
|
|
44
|
-
|
|
45
|
-
def git_init(self) -> git.Repo:
|
|
46
|
-
"""Initialize a git repository in the temporary folder."""
|
|
47
|
-
self.repo = git.Repo.init(str(self.repo_path))
|
|
48
|
-
self.assertIsInstance(self.repo, git.Repo)
|
|
49
|
-
self.repo.git.config('user.email', 'you@example.com')
|
|
50
|
-
self.repo.git.config('user.name', 'Your Name')
|
|
51
|
-
return self.repo
|
|
52
|
-
|
|
53
|
-
def git_clone(self, remote_name: str, url: str) -> git.Repo:
|
|
54
|
-
"""Clone a git repository into the temporary folder."""
|
|
55
|
-
self.repo = git.Repo.clone_from(url, str(self.repo_path), origin=remote_name)
|
|
56
|
-
self.assertIsInstance(self.repo, git.Repo)
|
|
57
|
-
self.repo.git.config('user.email', 'you@example.com')
|
|
58
|
-
self.repo.git.config('user.name', 'Your Name')
|
|
59
|
-
return self.repo
|
|
60
|
-
|
|
61
|
-
def git_commit_new_file(self) -> pathlib.Path:
|
|
62
|
-
"""Create a new file and commit it."""
|
|
63
|
-
with tempfile.NamedTemporaryFile('w', dir=str(self.repo_path), delete=False) as repo_file:
|
|
64
|
-
repo_file.write('spam spam lovely spam\n')
|
|
65
|
-
path = pathlib.Path(repo_file.name)
|
|
66
|
-
self.repo.index.add([path.name])
|
|
67
|
-
self.repo.index.commit(f'created file {path}')
|
|
68
|
-
_LOG.debug('commited file %s as %s', path, self.repo_head_hexsha)
|
|
69
|
-
self._repo_files.append(path)
|
|
70
|
-
return path
|
|
71
|
-
|
|
72
|
-
def git_modify_file(self, path: pathlib.Path, add: bool = False, commit: bool = False) -> None:
|
|
73
|
-
"""Modify an existing file."""
|
|
74
|
-
self.assertIsInstance(self.repo, git.Repo)
|
|
75
|
-
self.assertIsInstance(path, pathlib.Path)
|
|
76
|
-
self.assertTrue(path.is_file())
|
|
77
|
-
with path.open('a') as repo_file:
|
|
78
|
-
repo_file.write('spam eggs ham\n')
|
|
79
|
-
if add or commit:
|
|
80
|
-
self.repo.index.add([path.name])
|
|
81
|
-
if commit:
|
|
82
|
-
self.repo.index.commit(f'modified file {path}')
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
class GitRepoSelfTests(GitRepoTests):
|
|
86
|
-
"""Check that GitRepoTests class works."""
|
|
87
|
-
|
|
88
|
-
def test_typical(self):
|
|
89
|
-
self.git_init()
|
|
90
|
-
pth = self.git_commit_new_file()
|
|
91
|
-
self.git_modify_file(pth)
|
|
92
|
-
pth = self.git_commit_new_file()
|
|
93
|
-
self.git_modify_file(pth, add=True)
|
|
94
|
-
pth = self.git_commit_new_file()
|
|
95
|
-
self.git_modify_file(pth, commit=True)
|
|
96
|
-
|
|
97
|
-
def test_clone(self):
|
|
98
|
-
path = pathlib.Path(__file__).resolve().parent.parent
|
|
99
|
-
self.git_clone('origin', str(path))
|
|
100
|
-
|
|
101
|
-
def test_no_repo(self):
|
|
102
|
-
self.assertIsNone(self.repo)
|
|
103
|
-
|
|
104
|
-
def test_cleanup_nonexisting(self):
|
|
105
|
-
self.git_init()
|
|
106
|
-
pth = self.git_commit_new_file()
|
|
107
|
-
pth.unlink()
|
|
108
|
-
self.assertFalse(pth.is_file())
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|