Skip to content

Commit 26cf24c

Browse files
authored
Use Dynamic Version (#69)
1 parent 4546d54 commit 26cf24c

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

cppython/project.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
GeneratorConfiguration,
1717
Interface,
1818
Plugin,
19+
ProjectDataT,
1920
PyProject,
2021
ToolData,
2122
)
@@ -92,7 +93,20 @@ def create_generators(
9293

9394
return _generators
9495

95-
def generate_modified(self, original: CPPythonDataT) -> CPPythonDataT:
96+
def generate_modified_project(self, original: ProjectDataT) -> ProjectDataT:
97+
"""
98+
Applies dynamic behaviors of the settings to itself
99+
Returns a copy of the original with dynamic modifications
100+
"""
101+
modified = original.copy(deep=True)
102+
103+
# Update the dynamic version
104+
105+
modified.version = self.configuration.version
106+
107+
return modified
108+
109+
def generate_modified_cppython(self, original: CPPythonDataT) -> CPPythonDataT:
96110
"""
97111
Applies dynamic behaviors of the settings to itself
98112
Returns a copy of the original with dynamic modifications
@@ -231,7 +245,8 @@ def __init__(
231245

232246
self._project = pyproject.project
233247

234-
self._modified_cppython_data = self._builder.generate_modified(pyproject.tool.cppython)
248+
self._modified_project_data = self._builder.generate_modified_project(pyproject.project)
249+
self._modified_cppython_data = self._builder.generate_modified_cppython(pyproject.tool.cppython)
235250

236251
self._interface = interface
237252

@@ -259,9 +274,9 @@ def configuration(self) -> ProjectConfiguration:
259274
@property
260275
def project(self) -> PEP621:
261276
"""
262-
The pyproject project table
277+
The resolved pyproject project table
263278
"""
264-
return self._project
279+
return self._modified_project_data
265280

266281
@property
267282
def cppython(self):

pdm.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)