Skip to content

Use Dynamic Version #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions cppython/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
GeneratorConfiguration,
Interface,
Plugin,
ProjectDataT,
PyProject,
ToolData,
)
Expand Down Expand Up @@ -92,7 +93,20 @@ def create_generators(

return _generators

def generate_modified(self, original: CPPythonDataT) -> CPPythonDataT:
def generate_modified_project(self, original: ProjectDataT) -> ProjectDataT:
"""
Applies dynamic behaviors of the settings to itself
Returns a copy of the original with dynamic modifications
"""
modified = original.copy(deep=True)

# Update the dynamic version

modified.version = self.configuration.version

return modified

def generate_modified_cppython(self, original: CPPythonDataT) -> CPPythonDataT:
"""
Applies dynamic behaviors of the settings to itself
Returns a copy of the original with dynamic modifications
Expand Down Expand Up @@ -231,7 +245,8 @@ def __init__(

self._project = pyproject.project

self._modified_cppython_data = self._builder.generate_modified(pyproject.tool.cppython)
self._modified_project_data = self._builder.generate_modified_project(pyproject.project)
self._modified_cppython_data = self._builder.generate_modified_cppython(pyproject.tool.cppython)

self._interface = interface

Expand Down Expand Up @@ -259,9 +274,9 @@ def configuration(self) -> ProjectConfiguration:
@property
def project(self) -> PEP621:
"""
The pyproject project table
The resolved pyproject project table
"""
return self._project
return self._modified_project_data

@property
def cppython(self):
Expand Down
8 changes: 4 additions & 4 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.