@@ -152,6 +152,8 @@ def make_pyproject(repo_path: pathlib.Path, templates: Environment) -> List[str]
152152 data = DefaultDict ()
153153
154154 data .set_default ("build-system" , {})
155+ data .set_default ("tool" , {})
156+
155157 build_backend = "setuptools.build_meta"
156158
157159 build_requirements_ = {
@@ -198,39 +200,56 @@ def make_pyproject(repo_path: pathlib.Path, templates: Environment) -> List[str]
198200 data ["project" ]["license" ] = {"file" : "LICENSE" }
199201
200202 if templates .globals ["requires_python" ] is not None :
201- data ["project" ]["dynamic" ].pop ( 0 )
203+ data ["project" ]["dynamic" ].remove ( "requires-python" )
202204 data ["project" ]["requires-python" ] = f">={ templates .globals ['requires_python' ]} "
203-
204- url = "https://github.com/{username}/{repo_name}" .format_map (templates .globals )
205- data ["project" ]["urls" ] = {
206- "Homepage" : url ,
207- "Issue Tracker" : "https://github.com/{username}/{repo_name}/issues" .format_map (templates .globals ),
208- "Source Code" : url ,
209- }
210-
211- if templates .globals ["enable_docs" ]:
212- data ["project" ]["urls" ]["Documentation" ] = templates .globals ["docs_url" ]
213-
214- if templates .globals ["use_flit" ]:
215- data ["project" ]["dynamic" ] = []
216-
205+ elif not templates .globals ["use_whey" ]:
217206 if templates .globals ["requires_python" ] is None :
218207 if templates .globals ["min_py_version" ] in {"3.6" , 3.6 }:
219208 requires_python = "3.6.1"
220209 else :
221210 requires_python = templates .globals ["min_py_version" ]
222211 else :
223212 requires_python = templates .globals ["requires_python" ]
213+ if "requires-python" in data ["project" ]["dynamic" ]:
214+ data ["project" ]["dynamic" ].remove ("requires-python" )
224215
225216 data ["project" ]["requires-python" ] = f">={ requires_python } "
217+ elif "requires-python" in data ["project" ]:
218+ del data ["project" ]["requires-python" ]
219+
220+ if not templates .globals ["use_whey" ]:
221+ data ["project" ]["dynamic" ] = []
226222 data ["project" ]["classifiers" ] = _get_classifiers (templates .globals )
227- parsed_requirements , comments , invalid_lines = read_requirements (repo_path / "requirements.txt" , include_invalid = True )
228- if invalid_lines :
229- raise NotImplementedError (f"Unsupported requirement type(s): { invalid_lines } " )
230- data ["project" ]["dependencies" ] = sorted (parsed_requirements )
231223
232- # extras-require
224+ if templates .globals ["use_flit" ]:
225+ parsed_requirements , comments , invalid_lines = read_requirements (repo_path / "requirements.txt" , include_invalid = True )
226+ if invalid_lines :
227+ raise NotImplementedError (f"Unsupported requirement type(s): { invalid_lines } " )
228+ data ["project" ]["dependencies" ] = sorted (parsed_requirements )
229+ else :
230+ # TODO: currently broken by setuptools; have to omit for it to work
231+ # data["project"]["dynamic"].append("dependencies")
232+
233+ data ["tool" ].setdefault ("setuptools" , {})
234+ data ["tool" ]["setuptools" ]["zip-safe" ] = False
235+ data ["tool" ]["setuptools" ]["include-package-data" ] = True
236+ data ["tool" ]["setuptools" ]["platforms" ] = [
237+ "Windows" ,
238+ "macOS" ,
239+ "Linux" ,
240+ ]
241+
242+ url = "https://github.com/{username}/{repo_name}" .format_map (templates .globals )
243+ data ["project" ]["urls" ] = {
244+ "Homepage" : url ,
245+ "Issue Tracker" : "https://github.com/{username}/{repo_name}/issues" .format_map (templates .globals ),
246+ "Source Code" : url ,
247+ }
248+
249+ if templates .globals ["enable_docs" ]:
250+ data ["project" ]["urls" ]["Documentation" ] = templates .globals ["docs_url" ]
233251
252+ # extras-require
234253 data ["project" ]["optional-dependencies" ] = {}
235254
236255 for extra , dependencies in templates .globals ["extras_require" ].items ():
@@ -253,7 +272,6 @@ def make_pyproject(repo_path: pathlib.Path, templates: Environment) -> List[str]
253272 del data ["project" ]["entry-points" ]
254273
255274 # tool
256- data .set_default ("tool" , {})
257275
258276 # tool.mkrecipe
259277 if templates .globals ["enable_conda" ]:
@@ -311,6 +329,8 @@ def make_pyproject(repo_path: pathlib.Path, templates: Environment) -> List[str]
311329 # templates.globals["source_dir"],
312330 templates .globals ["import_name" ].split ('.' , 1 )[0 ],
313331 )
332+ elif "package" in data ["tool" ]["whey" ]:
333+ del data ["tool" ]["whey" ]["package" ]
314334
315335 if templates .globals ["manifest_additional" ]:
316336 data ["tool" ]["whey" ]["additional-files" ] = templates .globals ["manifest_additional" ]
0 commit comments