File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -161,9 +161,7 @@ class SetuptoolsConfig(BaseModel):
161161 ]
162162 description : str
163163 readme : Optional [Union [Path , List [Path ], File ]] = None
164- license : Optional [License ] = Field (
165- None , description = "An SPDX license identifier."
166- )
164+ license : Optional [License ] = Field (None , description = "An SPDX license identifier." )
167165 authors : Optional [List [STPerson ]] = None
168166 maintainers : Optional [List [STPerson ]] = None
169167 keywords : Optional [Set [str ]] = None
Original file line number Diff line number Diff line change 99from rich .pretty import pretty_repr
1010from tomlkit import load
1111
12- from somesy .core .models import Person ,ProjectMetadata
12+ from somesy .core .models import Person , ProjectMetadata
1313from somesy .core .writer import ProjectMetadataWriter
1414
1515from .models import PoetryConfig , SetuptoolsConfig
@@ -146,14 +146,16 @@ def _to_person(person_obj) -> Person:
146146 "email" : person_obj ["email" ].strip (),
147147 }
148148 )
149-
150-
149+
151150 def sync (self , metadata : ProjectMetadata ) -> None :
152151 """Sync metadata with pyproject.toml file and fix license field."""
153152 super ().sync (metadata )
154-
153+
155154 # if license field has both text and file, remove file
156- if self ._get_property (["license" , "file" ]) is not None and self ._get_property (["license" , "text" ]) is not None :
155+ if (
156+ self ._get_property (["license" , "file" ]) is not None
157+ and self ._get_property (["license" , "text" ]) is not None
158+ ):
157159 # delete license file property
158160 self ._data ["project" ]["license" ].pop ("file" )
159161 logger .debug ("Removed license file from pyproject.toml" )
Original file line number Diff line number Diff line change @@ -38,7 +38,9 @@ def assert_content_match(pyproject_file):
3838 pyproject_file .description
3939 == "This is a test package for demonstration purposes."
4040 )
41- assert pyproject_file .license == "MIT" or pyproject_file .license ["text" ] == "MIT"
41+ assert (
42+ pyproject_file .license == "MIT" or pyproject_file .license ["text" ] == "MIT"
43+ )
4244 assert len (pyproject_file .authors ) == 1
4345
4446 # assert for both formats
You can’t perform that action at this time.
0 commit comments