spl-core 7.6.1__tar.gz → 7.8.0__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.
Files changed (71) hide show
  1. {spl_core-7.6.1 → spl_core-7.8.0}/PKG-INFO +3 -1
  2. {spl_core-7.6.1 → spl_core-7.8.0}/pyproject.toml +3 -2
  3. spl_core-7.8.0/src/spl_core/__init__.py +1 -0
  4. spl_core-7.8.0/src/spl_core/steps/collect_pr_changes.py +97 -0
  5. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/test_utils/spl_build.py +7 -4
  6. spl_core-7.6.1/src/spl_core/__init__.py +0 -1
  7. spl_core-7.6.1/src/spl_core/common/command_line_executor.py +0 -70
  8. {spl_core-7.6.1 → spl_core-7.8.0}/LICENSE +0 -0
  9. {spl_core-7.6.1 → spl_core-7.8.0}/README.md +0 -0
  10. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/__run.py +0 -0
  11. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/common/__init__.py +0 -0
  12. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/common/path.py +0 -0
  13. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/common.cmake +0 -0
  14. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/conan.cmake +0 -0
  15. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/config/KConfig +0 -0
  16. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/gcov_maid/__init__.py +0 -0
  17. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/gcov_maid/gcov_maid.py +0 -0
  18. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kconfig/__init__.py +0 -0
  19. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kconfig/kconfig.py +0 -0
  20. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kconfig.cmake +0 -0
  21. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/__init__.py +0 -0
  22. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/create.py +0 -0
  23. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/application/.vscode/cmake-variants.json +0 -0
  24. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/application/KConfig +0 -0
  25. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/application/src/greeter/CMakeLists.txt +0 -0
  26. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/application/src/greeter/doc/_images/screenshot.png +0 -0
  27. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/application/src/greeter/doc/index.rst +0 -0
  28. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/application/src/greeter/src/greeter.c +0 -0
  29. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/application/src/greeter/src/greeter.h +0 -0
  30. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/application/src/greeter/test/test_greeter.cc +0 -0
  31. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/application/src/main/CMakeLists.txt +0 -0
  32. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/application/src/main/doc/index.rst +0 -0
  33. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/application/src/main/src/main.c +0 -0
  34. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/application/test/EnglishVariant/test__EnglishVariant.py +0 -0
  35. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/application/test/German/test__GermanVariant.py +0 -0
  36. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/application/variants/EnglishVariant/config.cmake +0 -0
  37. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/application/variants/EnglishVariant/parts.cmake +0 -0
  38. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/application/variants/GermanVariant/config.cmake +0 -0
  39. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/application/variants/GermanVariant/config.txt +0 -0
  40. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/application/variants/GermanVariant/parts.cmake +0 -0
  41. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/.gitignore +0 -0
  42. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/.vscode/cmake-kits.json +0 -0
  43. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/.vscode/extensions.json +0 -0
  44. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/.vscode/launch.json +0 -0
  45. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/.vscode/settings.json +0 -0
  46. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/.vscode/tasks.json +0 -0
  47. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/CMakeLists.txt +0 -0
  48. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/README.md +0 -0
  49. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/bootstrap.json +0 -0
  50. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/build.bat +0 -0
  51. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/build.ps1 +0 -0
  52. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/conf.py +0 -0
  53. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/doc/Doxyfile.in +0 -0
  54. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/doc/common/index.rst +0 -0
  55. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/doc/components/index.rst +0 -0
  56. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/doc/doxygen-awesome/LICENSE +0 -0
  57. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/doc/doxygen-awesome/doxygen-awesome.css +0 -0
  58. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/doc/software_architecture/index.rst +0 -0
  59. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/doc/software_requirements/index.rst +0 -0
  60. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/doc/test_report_template.txt +0 -0
  61. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/index.rst +0 -0
  62. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/pypeline.yaml +0 -0
  63. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/pyproject.toml +0 -0
  64. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/pytest.ini +0 -0
  65. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/scoopfile.json +0 -0
  66. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/tools/toolchains/clang/toolchain.cmake +0 -0
  67. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/kickstart/templates/project/tools/toolchains/gcc/toolchain.cmake +0 -0
  68. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/main.py +0 -0
  69. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/spl.cmake +0 -0
  70. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/test_utils/archive_artifacts_collection.py +0 -0
  71. {spl_core-7.6.1 → spl_core-7.8.0}/src/spl_core/test_utils/base_variant_test_runner.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: spl-core
3
- Version: 7.6.1
3
+ Version: 7.8.0
4
4
  Summary: Software Product Line Support for CMake
5
5
  License: MIT
6
6
  Author: Avengineers
@@ -23,6 +23,8 @@ Requires-Dist: kconfiglib (>=14.1,<15.0)
23
23
  Requires-Dist: mlx-traceability (>=10.0,<11.0)
24
24
  Requires-Dist: myst-parser (>=0.16)
25
25
  Requires-Dist: py-app-dev (>=2.1,<3.0)
26
+ Requires-Dist: pypeline-runner (>=1,<=2)
27
+ Requires-Dist: pypeline-semantic-release (>=0.4.1,<=0.5.0)
26
28
  Requires-Dist: sphinx (>=7.3,<8.0)
27
29
  Requires-Dist: sphinx-book-theme (>=1.1,<2.0)
28
30
  Requires-Dist: sphinx-copybutton (>=0.5,<0.6)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "spl-core"
3
- version = "7.6.1"
3
+ version = "7.8.0"
4
4
  description = "Software Product Line Support for CMake"
5
5
  authors = ["Avengineers <karsten.guenther@kamg.de>"]
6
6
  license = "MIT"
@@ -46,6 +46,8 @@ myst-parser = ">=0.16"
46
46
  mlx-traceability = "^10.0"
47
47
  sphinx-book-theme = "^1.1"
48
48
  sphinx-design = ">=0.5,<0.7"
49
+ pypeline-semantic-release = ">=0.4.1,<=0.5.0"
50
+ pypeline-runner = ">=1,<=2"
49
51
 
50
52
  [tool.poetry.group.dev.dependencies]
51
53
  pytest = ">=7,<9"
@@ -59,7 +61,6 @@ mashumaro = "*"
59
61
  loguru = "*"
60
62
  flake8 = "*"
61
63
  pipenv = "*"
62
- pypeline-runner = "^1.3"
63
64
  python-semantic-release = "^9.16.1"
64
65
 
65
66
  [tool.semantic_release]
@@ -0,0 +1 @@
1
+ __version__ = "7.8.0"
@@ -0,0 +1,97 @@
1
+ import json
2
+ from dataclasses import dataclass
3
+ from pathlib import Path
4
+ from typing import List, Optional
5
+
6
+ from mashumaro.mixins.json import DataClassJSONMixin
7
+ from py_app_dev.core.logging import logger
8
+ from py_app_dev.core.subprocess import SubprocessExecutor
9
+ from pypeline.domain.pipeline import PipelineStep
10
+ from pypeline_semantic_release.steps import CIContext
11
+
12
+
13
+ @dataclass
14
+ class PR_Changes(DataClassJSONMixin):
15
+ """Dataclass for storing PR changes."""
16
+
17
+ ci_system: str
18
+ target_branch: str
19
+ current_branch: str
20
+ commit_id: str
21
+ changed_files: List[str]
22
+
23
+
24
+ class CollectPRChanges(PipelineStep):
25
+ """Collect changed files from a pull request."""
26
+
27
+ def run(self) -> None:
28
+ logger.info(f"{self.get_name()}")
29
+ ci_contexts = self.execution_context.data_registry.find_data(CIContext)
30
+ if len(ci_contexts) > 0:
31
+ ci_context = ci_contexts[0]
32
+ logger.info(f"CI context: {ci_context}")
33
+ if ci_context.is_pull_request:
34
+ logger.info(f"Collecting PR changes between branch {ci_context.target_branch} and {ci_context.current_branch}")
35
+ changed_files = self._get_changed_files(ci_context.target_branch, ci_context.current_branch)
36
+ output_file = self.get_outputs()[0]
37
+ output_file.parent.mkdir(parents=True, exist_ok=True)
38
+ output_file.write_text(json.dumps(
39
+ PR_Changes(
40
+ ci_system=ci_context.ci_system.name, target_branch=ci_context.target_branch, current_branch=ci_context.current_branch, commit_id=self._get_commit_id(ci_context), changed_files=changed_files
41
+ ).to_dict(),
42
+ indent=2
43
+ ))
44
+ logger.info(f"PR changes saved to {output_file}")
45
+
46
+ def _get_changed_files(self, target_branch: str, current_branch: str) -> List[str]:
47
+ """Get list of changed files in the current branch/PR"""
48
+ try:
49
+ result = SubprocessExecutor(["git", "fetch", "origin", current_branch]).execute(handle_errors=False)
50
+ if result and result.returncode == 0:
51
+ result = SubprocessExecutor(["git", "diff", "--name-only", f"origin/{target_branch}...origin/{current_branch}"]).execute(handle_errors=False)
52
+
53
+ if result and result.returncode == 0 and result.stdout.strip():
54
+ files = [line.strip() for line in result.stdout.strip().split("\n") if line.strip()]
55
+ return files
56
+
57
+ except Exception as e:
58
+ logger.error(f"Git command failed: {e}")
59
+ return [] # Ensure a list is always returned
60
+ return []
61
+
62
+ def get_inputs(self) -> List[Path]:
63
+ return []
64
+
65
+ def get_outputs(self) -> List[Path]:
66
+ return [self.output_dir.joinpath("pr_changes.json")]
67
+
68
+ def get_name(self) -> str:
69
+ return self.__class__.__name__
70
+
71
+ def update_execution_context(self) -> None:
72
+ pass
73
+
74
+ def get_config(self) -> dict[str, str] | None:
75
+ """
76
+ Get runnable configuration.
77
+
78
+ (!) Do NOT put sensitive information in the configuration. It will be stored in a file.
79
+ """
80
+ return {"latest_commit": self._get_commit_id()}
81
+
82
+ def _get_commit_id(self, ci_context: Optional[CIContext] = None) -> str:
83
+ """Get the latest commit ID in the current branch."""
84
+ try:
85
+ if not ci_context:
86
+ ci_contexts = self.execution_context.data_registry.find_data(CIContext)
87
+ if len(ci_contexts) == 0:
88
+ logger.info("No CI context found.")
89
+ return ""
90
+ ci_context = ci_contexts[0]
91
+ if isinstance(ci_context, CIContext) and ci_context.is_pull_request:
92
+ result = SubprocessExecutor(["git", "rev-parse", f"origin/{ci_context.current_branch}"]).execute(handle_errors=False)
93
+ if result and result.returncode == 0:
94
+ return result.stdout.strip()
95
+ except Exception as e:
96
+ logger.info(f"Failed to get commit ID: {e}")
97
+ return ""
@@ -6,8 +6,7 @@ from pathlib import Path
6
6
  from typing import Callable, ClassVar, List, Optional
7
7
 
8
8
  from py_app_dev.core.logging import time_it
9
-
10
- from spl_core.common.command_line_executor import CommandLineExecutor
9
+ from py_app_dev.core.subprocess import SubprocessExecutor
11
10
 
12
11
 
13
12
  @dataclass
@@ -110,7 +109,7 @@ class SplBuild:
110
109
  target = self.target if self.target else "all"
111
110
  return_code = -1
112
111
  while True:
113
- cmd = [
112
+ cmd: list[str | Path] = [
114
113
  "build.bat",
115
114
  "-build",
116
115
  "-buildKit",
@@ -125,7 +124,11 @@ class SplBuild:
125
124
  cmd.extend(["-buildType", self.build_type])
126
125
  if additional_args:
127
126
  cmd.extend(additional_args)
128
- result = CommandLineExecutor().execute(cmd)
127
+ # Cast to Union[str, List[Union[str, Path]]] to satisfy SubprocessExecutor type
128
+ result = SubprocessExecutor(command=cmd).execute(handle_errors=False)
129
+ if result is None:
130
+ return_code = -1
131
+ break
129
132
  return_code = result.returncode
130
133
  if result.returncode:
131
134
  if result.stdout:
@@ -1 +0,0 @@
1
- __version__ = "7.6.1"
@@ -1,70 +0,0 @@
1
- import locale
2
- import subprocess
3
- from pathlib import Path
4
- from typing import Dict, List, Optional
5
-
6
-
7
- class CommandLineExecutor:
8
- def __init__(
9
- self,
10
- cwd: Optional[Path] = None,
11
- env: Optional[Dict[str, str]] = None,
12
- ):
13
- """
14
- A class for executing command line commands.
15
-
16
- Args:
17
- - cmd: A string or list of strings representing the command to be executed.
18
- - cwd: An optional Path object representing the current working directory.
19
- - env: An optional dictionary of environment variables to be used in the command execution.
20
- """
21
- self.current_working_directory = cwd
22
- self.env = env
23
-
24
- def execute(self, cmd: str | List[str]) -> subprocess.CompletedProcess[str]:
25
- """
26
- Executes the command and returns a CompletedProcess object.
27
-
28
- Returns:
29
- - A subprocess.CompletedProcess object representing the result of the command execution.
30
- """
31
- if isinstance(cmd, str):
32
- command: str | list[str] = cmd
33
- use_shell = True
34
- else:
35
- # Check if any argument contains quotes, which indicates shell processing is needed
36
- has_quotes = any('"' in arg or "'" in arg for arg in cmd)
37
- if has_quotes:
38
- command = " ".join(cmd)
39
- use_shell = True
40
- else:
41
- command = cmd
42
- use_shell = False
43
-
44
- output = ""
45
- try:
46
- print("=" * 120)
47
- print(f"= Running command: {command}")
48
- print("=" * 120)
49
- with subprocess.Popen(
50
- command,
51
- cwd=str(self.current_working_directory or Path.cwd()),
52
- stdout=subprocess.PIPE,
53
- stderr=subprocess.STDOUT,
54
- bufsize=1,
55
- text=True,
56
- env=self.env,
57
- universal_newlines=True,
58
- encoding=locale.getpreferredencoding(False),
59
- errors="replace",
60
- shell=use_shell,
61
- ) as process:
62
- if process.stdout:
63
- for line in process.stdout:
64
- print(line, end="")
65
- # We have to store the stdout content.
66
- # This is necessary because the stdout object is closed after we printed its content
67
- output += line
68
- except Exception:
69
- raise RuntimeError(f"Command '{command}' failed.") # noqa: B904
70
- return subprocess.CompletedProcess(args=command, returncode=process.returncode, stdout=output, stderr=None)
File without changes
File without changes
File without changes
File without changes