python-kacl 0.6.3__tar.gz → 0.6.4__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.
- {python_kacl-0.6.3/python_kacl.egg-info → python_kacl-0.6.4}/PKG-INFO +1 -1
- {python_kacl-0.6.3 → python_kacl-0.6.4}/kacl/__init__.py +1 -1
- {python_kacl-0.6.3 → python_kacl-0.6.4}/kacl/kacl_cli.py +8 -1
- {python_kacl-0.6.3 → python_kacl-0.6.4}/kacl/serializer.py +12 -9
- {python_kacl-0.6.3 → python_kacl-0.6.4}/kacl/version.py +2 -2
- {python_kacl-0.6.3 → python_kacl-0.6.4/python_kacl.egg-info}/PKG-INFO +1 -1
- {python_kacl-0.6.3 → python_kacl-0.6.4}/setup.py +1 -1
- {python_kacl-0.6.3 → python_kacl-0.6.4}/tests/test_cli.py +74 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/LICENSE +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/MANIFEST.in +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/README.md +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/kacl/__main__.py +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/kacl/changes.py +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/kacl/config/kacl-default.yml +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/kacl/config.py +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/kacl/document.py +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/kacl/element.py +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/kacl/exception.py +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/kacl/jira_client.py +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/kacl/link_provider.py +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/kacl/parser.py +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/kacl/utils.py +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/kacl/validation.py +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/python_kacl.egg-info/SOURCES.txt +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/python_kacl.egg-info/dependency_links.txt +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/python_kacl.egg-info/entry_points.txt +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/python_kacl.egg-info/not-zip-safe +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/python_kacl.egg-info/requires.txt +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/python_kacl.egg-info/top_level.txt +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/setup.cfg +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/tests/__init__.py +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/tests/snapshot_directory.py +0 -0
- {python_kacl-0.6.3 → python_kacl-0.6.4}/tests/test_kacl.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-kacl
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.4
|
|
4
4
|
Summary: Python module and CLI tool for validating and modifying Changelogs in "keep-a-changelog" format"
|
|
5
5
|
Home-page: https://gitlab.com/schmieder.matthias/python-kacl.git
|
|
6
6
|
Author: Matthias Schmieder
|
|
@@ -177,7 +177,12 @@ def next(ctx, version):
|
|
|
177
177
|
@cli.command()
|
|
178
178
|
@click.pass_context
|
|
179
179
|
@click.argument("version", type=str)
|
|
180
|
-
|
|
180
|
+
@click.option(
|
|
181
|
+
"--no-link",
|
|
182
|
+
is_flag=True,
|
|
183
|
+
help="This option suppresses a link, even if available.",
|
|
184
|
+
)
|
|
185
|
+
def get(ctx, version, no_link):
|
|
181
186
|
"""Returns a given version from the Changelog."""
|
|
182
187
|
kacl_changelog = load_changelog(ctx)
|
|
183
188
|
|
|
@@ -185,6 +190,8 @@ def get(ctx, version):
|
|
|
185
190
|
kacl_version = kacl_changelog.get(version)
|
|
186
191
|
|
|
187
192
|
if kacl_version:
|
|
193
|
+
if no_link:
|
|
194
|
+
kacl_version.set_link(None)
|
|
188
195
|
kacl_changelog_content = kacl.dump(kacl_version)
|
|
189
196
|
click.echo(kacl_changelog_content)
|
|
190
197
|
else:
|
|
@@ -11,9 +11,9 @@ class KACLMarkdownSerializer:
|
|
|
11
11
|
pass
|
|
12
12
|
|
|
13
13
|
def serialize(self, document):
|
|
14
|
+
data = []
|
|
15
|
+
link_references = []
|
|
14
16
|
if isinstance(document, KACLDocument):
|
|
15
|
-
data = []
|
|
16
|
-
|
|
17
17
|
serialized_metadata = self.__serialize_metadata(document.metadata())
|
|
18
18
|
if serialized_metadata:
|
|
19
19
|
data.extend(serialized_metadata)
|
|
@@ -21,20 +21,23 @@ class KACLMarkdownSerializer:
|
|
|
21
21
|
data.append(self.__serialize_header(document.header()))
|
|
22
22
|
data.append(document.header().body())
|
|
23
23
|
|
|
24
|
-
link_references = []
|
|
25
24
|
for version in document.versions():
|
|
26
25
|
data.extend([self.__serialize_version(version), ""])
|
|
27
26
|
if version.has_link_reference():
|
|
28
27
|
link_references.append(self.__serialize_link_reference(version))
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
elif isinstance(document, KACLVersion):
|
|
30
|
+
data.extend([self.__serialize_version(document), ""])
|
|
31
31
|
|
|
32
|
-
if
|
|
33
|
-
|
|
32
|
+
if document.has_link_reference():
|
|
33
|
+
link_references.append(self.__serialize_link_reference(document))
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
data.extend(link_references)
|
|
36
|
+
|
|
37
|
+
if data[-1] != "":
|
|
38
|
+
data.append("")
|
|
39
|
+
|
|
40
|
+
return "\n".join(data)
|
|
38
41
|
|
|
39
42
|
def __serialize_metadata(self, metadata):
|
|
40
43
|
if not metadata:
|
|
@@ -47,9 +47,9 @@ class KACLVersion(KACLElement):
|
|
|
47
47
|
return self.__link_reference.body()
|
|
48
48
|
|
|
49
49
|
def set_link(self, link):
|
|
50
|
-
if isinstance(link, KACLElement):
|
|
50
|
+
if not link or isinstance(link, KACLElement):
|
|
51
51
|
self.__link_reference = link
|
|
52
|
-
|
|
52
|
+
else:
|
|
53
53
|
self.__link_reference = KACLElement(title=self.version(), body=link)
|
|
54
54
|
|
|
55
55
|
def has_link_reference(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-kacl
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.4
|
|
4
4
|
Summary: Python module and CLI tool for validating and modifying Changelogs in "keep-a-changelog" format"
|
|
5
5
|
Home-page: https://gitlab.com/schmieder.matthias/python-kacl.git
|
|
6
6
|
Author: Matthias Schmieder
|
|
@@ -11,7 +11,7 @@ this_directory = path.abspath(path.dirname(__file__))
|
|
|
11
11
|
with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
|
|
12
12
|
long_description = f.read()
|
|
13
13
|
|
|
14
|
-
version = "0.6.
|
|
14
|
+
version = "0.6.4"
|
|
15
15
|
|
|
16
16
|
version = f"{version}{os.environ.get('PIP_VERSION_POSTFIX', '')}"
|
|
17
17
|
|
|
@@ -416,3 +416,77 @@ def test_add_comments(tmp_path):
|
|
|
416
416
|
catch_exceptions=False,
|
|
417
417
|
)
|
|
418
418
|
assert result.exit_code == 0, result.output
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
@freeze_time("2023-01-01")
|
|
422
|
+
def test_get_no_link_available(tmp_path, snapshot):
|
|
423
|
+
runner = CliRunner()
|
|
424
|
+
resources_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data/")
|
|
425
|
+
changelog_file = os.path.join(resources_dir, "CHANGELOG_missing_link.md")
|
|
426
|
+
|
|
427
|
+
with runner.isolated_filesystem(temp_dir=tmp_path) as project_root_path:
|
|
428
|
+
result = runner.invoke(
|
|
429
|
+
cli,
|
|
430
|
+
[
|
|
431
|
+
"-c",
|
|
432
|
+
os.path.join(resources_dir, "extension-config.yml"),
|
|
433
|
+
"-f",
|
|
434
|
+
changelog_file,
|
|
435
|
+
"get",
|
|
436
|
+
"2.0.0",
|
|
437
|
+
],
|
|
438
|
+
catch_exceptions=False,
|
|
439
|
+
)
|
|
440
|
+
assert result.exit_code == 0, result.output
|
|
441
|
+
with open(os.path.join(project_root_path, "output.md"), "w") as file:
|
|
442
|
+
file.write(result.output)
|
|
443
|
+
snapshot_directory(snapshot=snapshot, directory_path=project_root_path)
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
def test_get_link_available(tmp_path, snapshot):
|
|
447
|
+
runner = CliRunner()
|
|
448
|
+
resources_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data/")
|
|
449
|
+
changelog_file = os.path.join(resources_dir, "CHANGELOG_missing_link.md")
|
|
450
|
+
|
|
451
|
+
with runner.isolated_filesystem(temp_dir=tmp_path) as project_root_path:
|
|
452
|
+
result = runner.invoke(
|
|
453
|
+
cli,
|
|
454
|
+
[
|
|
455
|
+
"-c",
|
|
456
|
+
os.path.join(resources_dir, "extension-config.yml"),
|
|
457
|
+
"-f",
|
|
458
|
+
changelog_file,
|
|
459
|
+
"get",
|
|
460
|
+
"1.0.0",
|
|
461
|
+
],
|
|
462
|
+
catch_exceptions=False,
|
|
463
|
+
)
|
|
464
|
+
assert result.exit_code == 0, result.output
|
|
465
|
+
with open(os.path.join(project_root_path, "output.md"), "w") as file:
|
|
466
|
+
file.write(result.output)
|
|
467
|
+
snapshot_directory(snapshot=snapshot, directory_path=project_root_path)
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
def test_get_suppress_available_link(tmp_path, snapshot):
|
|
471
|
+
runner = CliRunner()
|
|
472
|
+
resources_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data/")
|
|
473
|
+
changelog_file = os.path.join(resources_dir, "CHANGELOG_missing_link.md")
|
|
474
|
+
|
|
475
|
+
with runner.isolated_filesystem(temp_dir=tmp_path) as project_root_path:
|
|
476
|
+
result = runner.invoke(
|
|
477
|
+
cli,
|
|
478
|
+
[
|
|
479
|
+
"-c",
|
|
480
|
+
os.path.join(resources_dir, "extension-config.yml"),
|
|
481
|
+
"-f",
|
|
482
|
+
changelog_file,
|
|
483
|
+
"get",
|
|
484
|
+
"--no-link",
|
|
485
|
+
"1.0.0",
|
|
486
|
+
],
|
|
487
|
+
catch_exceptions=False,
|
|
488
|
+
)
|
|
489
|
+
assert result.exit_code == 0, result.output
|
|
490
|
+
with open(os.path.join(project_root_path, "output.md"), "w") as file:
|
|
491
|
+
file.write(result.output)
|
|
492
|
+
snapshot_directory(snapshot=snapshot, directory_path=project_root_path)
|
|
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
|
|
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
|