Closed Repiteo closed 8 months ago
It looks like basic support was introduced in 3.5; not sure about the minimum version of these changes.
If you like, I could externalize the type hints to stub files, similar to how typescript adds types to legacy javascript libraries, which would address both the minimum version and the presence of changes to ninja_syntax.py
.
Having given this more thought, it should be possible to leave ninja_syntax.py
unchanged (minus hinting) & have the conversions occur before getting passed down. I'll test that locally and see if we can retain the benefits of added readability
Hmm, well it works, but there's quite a lot of Path
used in project.py
, so there's two main options I would consider:
ninja_syntax.py
be custom-tailored to this repoPath
for os.path
equivalents; this would keep everything string-basedLooks great as-is! Thanks for the PR.
Will have to update requirements to say Python 3.8+. Hopefully not too many people are running older versions...
If it helps, 3.7 reached EOL last year.
Part of figuring out what is causing inconsistencies with my prior PR was needing a more concrete and unambiguous foundation to work with. To that end, this PR adds a ton of adjustments to the various tool scripts. Most prominently: type hints are now available on every single file. While this did occasionally get a bit wordy (shoutouts to
NinjaPaths
inninja_syntax.py
), this ultimately made the expected input and output a lot more parsableSeveral functions were adjusted in this process, albeit without changing the fundamental intent. There is, however, one primary exception to this: passing paths can now be done directly! The conversion process will now be handled in
ninja_syntax.py
natively, so the streamlinedPath
syntax can be freely used inproject.py
without worry. What's more, because of theUnion
functionality, strings and paths can be passed interchangably, either in isolation or as a collection, and the ninja builder just handles it