python-semantic-release 9.7.1__py3-none-any.whl → 9.7.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-semantic-release
3
- Version: 9.7.1
3
+ Version: 9.7.3
4
4
  Summary: Automatic Semantic Versioning for Python projects
5
5
  Author-email: Rolf Erik Lekang <me@rolflekang.com>
6
6
  License: MIT
@@ -32,6 +32,8 @@ Requires-Dist: importlib-resources ~=6.0
32
32
  Requires-Dist: pydantic ~=2.0
33
33
  Requires-Dist: rich ~=13.0
34
34
  Requires-Dist: shellingham ~=1.5
35
+ Provides-Extra: build
36
+ Requires-Dist: build ~=1.2 ; extra == 'build'
35
37
  Provides-Extra: dev
36
38
  Requires-Dist: pre-commit ~=3.5 ; extra == 'dev'
37
39
  Requires-Dist: tox ~=4.11 ; extra == 'dev'
@@ -1,4 +1,4 @@
1
- semantic_release/__init__.py,sha256=krtzynBQMkAxcs4erZCWloYTtIacwM2k7V4_WgQUR6M,870
1
+ semantic_release/__init__.py,sha256=AZQWQT9mepV90IGGzHfKVqLS8S9iWbQ8KQInlRZaCAo,870
2
2
  semantic_release/__main__.py,sha256=vXOARLV7KHeVXgpOMU0Q-8wovpdsOrtTsycxulI5xIE,106
3
3
  semantic_release/const.py,sha256=Z1o2QNh60wSLeF-_1TemMBjU3ZXbV0XghnUFsbTVfOs,831
4
4
  semantic_release/enums.py,sha256=D5B_reQGGKQQT22HO5PUtvn2Bok3fkht6TfJtXkmAUg,1020
@@ -10,7 +10,7 @@ semantic_release/changelog/release_history.py,sha256=ShzZpxTjhxka6TMbzOzYzG3EuCH
10
10
  semantic_release/changelog/template.py,sha256=JqZcjdozM9-059Sa8PfiHxYNeyZFa0jxk_beyRLv5sU,4640
11
11
  semantic_release/cli/__init__.py,sha256=gwAYhZO-4TR0tKCkQ4GqutWsL--0CII2_dcbrElI4M4,419
12
12
  semantic_release/cli/common.py,sha256=cVQUI7Uaac_nJ7VEXuJ7Q9pVJpuMVRvE7bBl_i96g20,1439
13
- semantic_release/cli/config.py,sha256=1q7tNFC4Re8gcctZyIGSKcj6qZ59W5mx9ed2yk5bgSA,20389
13
+ semantic_release/cli/config.py,sha256=NhXw_qi-KElU2xd_mw1MrBo3zgstzn1c0ZOCSQNTu8s,21769
14
14
  semantic_release/cli/const.py,sha256=S8oNNpSaKdZxcAs7PAKEjQHic0czoJBGd7XHo57FOzw,39
15
15
  semantic_release/cli/github_actions_output.py,sha256=Wy4jEIpSFgoMyJqq4FD7scIpgovivutFLZ7Fs4y2CUY,2110
16
16
  semantic_release/cli/masking_filter.py,sha256=DxqjiJyABlzwwwZ1r8JGQpb6QrF00StJFm0-2-s5Fv0,3071
@@ -21,7 +21,7 @@ semantic_release/cli/commands/cli_context.py,sha256=fOLTUKb4UnZGQ6zVhftuvdfZ7fK7
21
21
  semantic_release/cli/commands/generate_config.py,sha256=2xZOu3NpyhBp0pWr7d8ugKl_kjqQgpSsSMHq5wHTfrE,1699
22
22
  semantic_release/cli/commands/main.py,sha256=LuL-O0LGonI5fQTZn0AUtYv2Ei_CYyNqYHMF_wN4InI,2900
23
23
  semantic_release/cli/commands/publish.py,sha256=ZA7DuEGxZdIT9wUwP1S24qi1RdcKV-1FnYci-PvyXIg,1958
24
- semantic_release/cli/commands/version.py,sha256=liG9q4f_pH0ISGMODJ-qYbIv-OoLggfOx6RCOnA7ow8,25912
24
+ semantic_release/cli/commands/version.py,sha256=cURNIwQrdrENnUwMVpSQ42kD80TZ5uqy45Ia3nBLCQc,26160
25
25
  semantic_release/commit_parser/__init__.py,sha256=cv5HFBdw7OJd4Laj4Ex8ZZ5Tml8GwXgQcXW6Pasr2Ao,615
26
26
  semantic_release/commit_parser/_base.py,sha256=D2dY8dALV3QPK0XOLZru9btMW5dlx9YSmDIe3v5T0QA,3004
27
27
  semantic_release/commit_parser/angular.py,sha256=ERWeTBTFNIBOaTIopY4Vff0KbeFwrSQWbADe3smVW-8,4579
@@ -46,10 +46,10 @@ semantic_release/version/algorithm.py,sha256=-9ulTy1z4u-jUvbc-FrvEdFL7Omc3O3HhaP
46
46
  semantic_release/version/declaration.py,sha256=f6Ld7hIhrqvDrRBapJHr-KDimuyo-4IG8009Zu9BIgU,7357
47
47
  semantic_release/version/translator.py,sha256=P1noIsVBn8u6zNOFjG0xKYOWapxqf_PHSMvMeLJ9kXg,3050
48
48
  semantic_release/version/version.py,sha256=6PCtSbLP88U1daoxnCwHc--YguZo4waGNLqJ5JfeczE,14175
49
- python_semantic_release-9.7.1.dist-info/AUTHORS.rst,sha256=XOReVvpymEFUPsS2QPH97jlfJBVrxwS2eu8-jVAe4gk,230
50
- python_semantic_release-9.7.1.dist-info/LICENSE,sha256=NE85nszX252sdQdu0xgS9qwfYES0k8qS6gW3uO4jRGE,1083
51
- python_semantic_release-9.7.1.dist-info/METADATA,sha256=iOBlBV0FtzFENmtLg4TaQVCmUXHTtfeKXDlqUUK_SlM,5336
52
- python_semantic_release-9.7.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
53
- python_semantic_release-9.7.1.dist-info/entry_points.txt,sha256=qojUBx_Ywf4u7KgP6NWlDaBDymZVUGQ7m5wF2duC2F0,95
54
- python_semantic_release-9.7.1.dist-info/top_level.txt,sha256=qYA24nyg3eP-ti5UW7Vuj2aXVmM0wqVHx4mREdRZNAA,17
55
- python_semantic_release-9.7.1.dist-info/RECORD,,
49
+ python_semantic_release-9.7.3.dist-info/AUTHORS.rst,sha256=XOReVvpymEFUPsS2QPH97jlfJBVrxwS2eu8-jVAe4gk,230
50
+ python_semantic_release-9.7.3.dist-info/LICENSE,sha256=NE85nszX252sdQdu0xgS9qwfYES0k8qS6gW3uO4jRGE,1083
51
+ python_semantic_release-9.7.3.dist-info/METADATA,sha256=oTsw-ui914QMQuaBDHR-XOaqFBOL3l3zJ9wajIjGCtY,5404
52
+ python_semantic_release-9.7.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
53
+ python_semantic_release-9.7.3.dist-info/entry_points.txt,sha256=qojUBx_Ywf4u7KgP6NWlDaBDymZVUGQ7m5wF2duC2F0,95
54
+ python_semantic_release-9.7.3.dist-info/top_level.txt,sha256=qYA24nyg3eP-ti5UW7Vuj2aXVmM0wqVHx4mREdRZNAA,17
55
+ python_semantic_release-9.7.3.dist-info/RECORD,,
@@ -24,7 +24,7 @@ from semantic_release.version import (
24
24
  tags_and_versions,
25
25
  )
26
26
 
27
- __version__ = "9.7.1"
27
+ __version__ = "9.7.3"
28
28
 
29
29
 
30
30
  def setup_hook(argv: list[str]) -> None:
@@ -517,7 +517,7 @@ def version( # noqa: C901
517
517
  filter(
518
518
  lambda k_v: k_v[1] is not None, # type: ignore
519
519
  {
520
- "NEW_VERSION": str(new_version),
520
+ # Common values
521
521
  "PATH": os.getenv("PATH", ""),
522
522
  "HOME": os.getenv("HOME", None),
523
523
  "VIRTUAL_ENV": os.getenv("VIRTUAL_ENV", None),
@@ -535,6 +535,10 @@ def version( # noqa: C901
535
535
  "PSR_DOCKER_GITHUB_ACTION": os.getenv(
536
536
  "PSR_DOCKER_GITHUB_ACTION", None
537
537
  ),
538
+ # User defined overrides of environment (from config)
539
+ **runtime.build_command_env,
540
+ # PSR injected environment variables
541
+ "NEW_VERSION": str(new_version),
538
542
  }.items(),
539
543
  )
540
544
  ),
@@ -212,6 +212,7 @@ class RawConfig(BaseModel):
212
212
  assets: List[str] = []
213
213
  branches: Dict[str, BranchConfig] = {"main": BranchConfig()}
214
214
  build_command: Optional[str] = None
215
+ build_command_env: List[str] = []
215
216
  changelog: ChangelogConfig = ChangelogConfig()
216
217
  commit_author: MaybeFromEnv = EnvConfigVar(
217
218
  env="GIT_COMMIT_AUTHOR", default=DEFAULT_COMMIT_AUTHOR
@@ -229,6 +230,11 @@ class RawConfig(BaseModel):
229
230
  version_toml: Optional[Tuple[str, ...]] = None
230
231
  version_variables: Optional[Tuple[str, ...]] = None
231
232
 
233
+ @field_validator("build_command_env", mode="after")
234
+ @classmethod
235
+ def remove_whitespace(cls, val: list[str]) -> list[str]:
236
+ return [entry.strip() for entry in val]
237
+
232
238
  @model_validator(mode="after")
233
239
  def set_default_opts(self) -> Self:
234
240
  # Set the default parser options for the given commit parser when no user input is given
@@ -352,6 +358,7 @@ class RuntimeContext:
352
358
  template_environment: Environment
353
359
  template_dir: Path
354
360
  build_command: Optional[str]
361
+ build_command_env: dict[str, str]
355
362
  dist_glob_patterns: Tuple[str, ...]
356
363
  upload_to_vcs_release: bool
357
364
  global_cli_options: GlobalCommandLineOptions
@@ -541,6 +548,31 @@ class RuntimeContext:
541
548
  tag_format=raw.tag_format, prerelease_token=branch_config.prerelease_token
542
549
  )
543
550
 
551
+ build_cmd_env = {}
552
+
553
+ for i, env_var_def in enumerate(raw.build_command_env):
554
+ # creative hack to handle, missing =, but also = that then can be unpacked
555
+ # as the resulting parts array can be either 2 or 3 in length. it becomes 3
556
+ # with our forced empty value at the end which can be dropped
557
+ parts = [*env_var_def.split("=", 1), ""]
558
+ # removes any odd spacing around =, and extracts name=value
559
+ name, env_val = [part.strip() for part in parts[:2]]
560
+
561
+ if not name:
562
+ # Skip when invalid format (ex. starting with = and no name)
563
+ logging.warning(
564
+ "Skipping invalid build_command_env[%s] definition",
565
+ i,
566
+ )
567
+ continue
568
+
569
+ if not env_val and env_var_def[-1] != "=":
570
+ # avoid the edge case that user wants to define a value as empty
571
+ # and don't autoresolve it
572
+ env_val = os.getenv(name, "")
573
+
574
+ build_cmd_env[name] = env_val
575
+
544
576
  self = cls(
545
577
  repo=repo,
546
578
  commit_parser=commit_parser,
@@ -548,6 +580,7 @@ class RuntimeContext:
548
580
  major_on_zero=raw.major_on_zero,
549
581
  allow_zero_version=raw.allow_zero_version,
550
582
  build_command=raw.build_command,
583
+ build_command_env=build_cmd_env,
551
584
  version_declarations=tuple(version_declarations),
552
585
  hvcs_client=hvcs_client,
553
586
  changelog_file=changelog_file,