python-kacl 0.4.6__py3-none-any.whl → 0.4.7__py3-none-any.whl

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.
kacl/__init__.py CHANGED
@@ -1,5 +1,5 @@
1
1
  # Version of the python-kacl package
2
- __version__ = "0.4.6"
2
+ __version__ = "0.4.7"
3
3
 
4
4
  from kacl.document import KACLDocument
5
5
  from kacl.serializer import KACLMarkdownSerializer
kacl/document.py CHANGED
@@ -229,12 +229,20 @@ class KACLDocument:
229
229
  version {[str]} -- semantic versioning string
230
230
  increment {[str]} -- use either 'patch', 'minor', or 'major' to automatically increment the last version
231
231
  """
232
+
233
+ # check if 'post_release_version_prefix' is set
234
+ post_release_version_prefix = self.config.post_release_version_prefix
235
+
232
236
  if increment:
233
237
  v = self.current_version()
234
238
  if v:
235
239
  sv = semver.VersionInfo.parse(v)
236
240
  if "post" == increment:
237
- sv = sv.bump_prerelease(token="post")
241
+ if not post_release_version_prefix:
242
+ raise KACLException(
243
+ "No 'post_release_version_prefix' set in the config. Incrementing not possible"
244
+ )
245
+ sv = sv.bump_prerelease(token=post_release_version_prefix)
238
246
  elif "patch" == increment:
239
247
  sv = sv.bump_patch()
240
248
  elif "minor" == increment:
@@ -282,8 +290,6 @@ class KACLDocument:
282
290
  patch=future_version.patch,
283
291
  )
284
292
 
285
- # check if 'post_release_version_prefix' is set
286
- post_release_version_prefix = self.config.post_release_version_prefix
287
293
  comp_result = 0
288
294
  if post_release_version_prefix:
289
295
  # 2.1 Check if 'future version' is a 'post version'
kacl/version.py CHANGED
@@ -215,7 +215,7 @@ class KACLVersion(KACLElement):
215
215
  KACLValidationError(
216
216
  line=element.raw(),
217
217
  line_number=element.line_number(),
218
- error_message=f'"{title}" is not a valid section for a version. Options are [{",".join( config.allowed_version_sections)}]',
218
+ error_message=f'"{title}" is not a valid section for a version. Options are [{",".join(config.allowed_version_sections)}]',
219
219
  start_character_pos=start_pos,
220
220
  end_character_pos=end_pos,
221
221
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-kacl
3
- Version: 0.4.6
3
+ Version: 0.4.7
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
@@ -1,8 +1,8 @@
1
- kacl/__init__.py,sha256=euLhodK6bO3OJl7a95-XnJeSdAZ11RppzjoIh_Yc09Q,644
1
+ kacl/__init__.py,sha256=MeUbjqHeLOD_nVRpHOQ1aSatQj5jZLmW67hvXxUOyKQ,644
2
2
  kacl/__main__.py,sha256=cpulIGoFUJNN5ZW9oUoNN1PnBvrOyJ24xwtpf_yRwgQ,91
3
3
  kacl/changes.py,sha256=A0POz-xFMpFuq7nISnx_K75xOZOMmBuHq6EZ8NOQDsU,661
4
4
  kacl/config.py,sha256=xFWFzsPay09tBmlCClO9FrXpE7IVA0--Zc2ty8Lcvfs,2792
5
- kacl/document.py,sha256=x0AQvWL8zP2uGvWSAtPsSr3O5pKWYqOwZ28PV-61-GU,20447
5
+ kacl/document.py,sha256=iHd22-Q0iAJQd6euFyU1pSXTDPV9Ulr8eoawnoBwm_M,20697
6
6
  kacl/element.py,sha256=OG02QI8ND5fJpBMceT6dbIHr4uX9gLxK_fPCsOvMDHI,416
7
7
  kacl/exception.py,sha256=MfOVpUvhcQtm10rSY__74-oLo445PG8mLFGJPPIfXH0,41
8
8
  kacl/kacl_cli.py,sha256=lJhbLPg8JorEiKNlsWT4wsfUKyNXkaeYe7Jtzo57eLk,16276
@@ -10,15 +10,15 @@ kacl/link_provider.py,sha256=uZ5rpZI9BWUo5e0fw_TsOb9mgvpCWDuJu72LxrW-T5g,1654
10
10
  kacl/parser.py,sha256=kCLMLtVnaynzuBSkQT-qShNwqUmleBuGuMS6nECrlyU,2338
11
11
  kacl/serializer.py,sha256=nxEIpFyNIyH1nGa8Cr3RD6h6a2n9voYOOou-FMPMoJA,2279
12
12
  kacl/validation.py,sha256=b9r_5CyY6Cmi9BePh47IgZ3j64zdVsoB_fFvucieNbw,2125
13
- kacl/version.py,sha256=3UYpOzWqks20uXF9BUcjxo5P979MPiVyzlN1qOqV3mU,9533
13
+ kacl/version.py,sha256=OooYgbCgH6p0fYPOlU_V-I1pwnCVgLSZ2uOg2gjaogw,9532
14
14
  kacl/config/kacl-default.yml,sha256=Dr7rqgDovViIkA1ueIGHMWMjtTry4IKkJI5P-0wHeEg,991
15
15
  tests/__init__.py,sha256=dwb12vsojIwrtIgqwjc2fWhEVgVoiedUaVpZ7kusfY0,23
16
16
  tests/snapshot_directory.py,sha256=yH_ZpzJG5nA6F1ZxCrFPpbxBBON6bxSYO5OYZqKuzZA,1264
17
17
  tests/test_cli.py,sha256=DuE1fBTVAUkkXsVBCBg5J4L8mOowPSHdhlTtMfwo8Gs,7349
18
- tests/test_kacl.py,sha256=H9H7e0Zy4qGaIOnpwRSv6FFjDGG_A_vuJBhgQ6tTIjc,12545
19
- python_kacl-0.4.6.dist-info/LICENSE,sha256=TRSJOIt7LZuMeZXFleJVL_LHczSxqi70HEiTLT-kI8Q,1075
20
- python_kacl-0.4.6.dist-info/METADATA,sha256=EunJAhaWQq76s2Qcqxl-z7JshtAQgQWVi93f2OANdUo,19310
21
- python_kacl-0.4.6.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
22
- python_kacl-0.4.6.dist-info/entry_points.txt,sha256=8oCwuEyBEH-Z1M_xZIUePgfM7HfkYUAwcXdTPdrnwt4,49
23
- python_kacl-0.4.6.dist-info/top_level.txt,sha256=25gO0j-S3j_-DCptjHqVBlJi3tH_tiN8qyympi1E_Ys,11
24
- python_kacl-0.4.6.dist-info/RECORD,,
18
+ tests/test_kacl.py,sha256=oQPk41MoCNXifWRdpCRcdpKhsG21a3KCKIwuwImWUTY,13467
19
+ python_kacl-0.4.7.dist-info/LICENSE,sha256=TRSJOIt7LZuMeZXFleJVL_LHczSxqi70HEiTLT-kI8Q,1075
20
+ python_kacl-0.4.7.dist-info/METADATA,sha256=zcnv0WFNYJzakL5HH6MHAqLh-Q5mYbls2z2jH-ut0qc,19310
21
+ python_kacl-0.4.7.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
22
+ python_kacl-0.4.7.dist-info/entry_points.txt,sha256=8oCwuEyBEH-Z1M_xZIUePgfM7HfkYUAwcXdTPdrnwt4,49
23
+ python_kacl-0.4.7.dist-info/top_level.txt,sha256=25gO0j-S3j_-DCptjHqVBlJi3tH_tiN8qyympi1E_Ys,11
24
+ python_kacl-0.4.7.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.40.0)
2
+ Generator: setuptools (70.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
tests/test_kacl.py CHANGED
@@ -240,6 +240,7 @@ class TestKacl(TestCase):
240
240
 
241
241
  for increment, expected_version in fail_tests.items():
242
242
  changelog = kacl.load(changelog_file)
243
+ changelog.config.post_release_version_prefix = None
243
244
 
244
245
  msg = "This is my first added change"
245
246
  changelog.add("Added", msg)
@@ -269,6 +270,28 @@ class TestKacl(TestCase):
269
270
  changelog.release(increment=increment)
270
271
  self.assertEqual(expected_version, changelog.current_version())
271
272
 
273
+ def test_release_with_increment_extension_hotfix(self):
274
+ tests = {
275
+ "major": "2.0.0",
276
+ "minor": "1.1.0",
277
+ "patch": "1.0.1",
278
+ "post": "1.0.0-hotfix.1",
279
+ }
280
+ changelog_file = os.path.join(
281
+ os.path.dirname(os.path.realpath(__file__)), "data/CHANGELOG.md"
282
+ )
283
+
284
+ for increment, expected_version in tests.items():
285
+ changelog = kacl.load(changelog_file)
286
+ changelog.config.post_release_version_prefix = "hotfix"
287
+
288
+ msg = "This is my first added change"
289
+ changelog.add("Added", msg)
290
+
291
+ self.assertTrue(changelog.has_changes())
292
+ changelog.release(increment=increment)
293
+ self.assertEqual(expected_version, changelog.current_version())
294
+
272
295
  def test_post_release_with_increment(self):
273
296
  tests = {
274
297
  "major": "2.0.0",
@@ -282,6 +305,7 @@ class TestKacl(TestCase):
282
305
 
283
306
  for increment, expected_version in tests.items():
284
307
  changelog = kacl.load(changelog_file)
308
+ changelog.config.post_release_version_prefix = "post"
285
309
 
286
310
  msg = "This is my first added change"
287
311
  changelog.add("Added", msg)