refactor: use pathlib for the paths that can take it - #347
Merged
Conversation
Convert the os.path.abspath and os.path.dirname calls whose pathlib equivalent behaves the same, and take the vs2dt main source from the parent directory rather than from a ".." segment abspath had to normalize away. The four that are left are commented with what they rely on: dirname giving the empty string for a target with no directory, which Path.parent gives as ".", and abspath removing the ".." segments so that two spellings of a target count as one in the build targets list.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #347 +/- ##
=============================================
- Coverage 80.911% 80.894% -0.018%
=============================================
Files 20 20
Lines 3269 3266 -3
=============================================
- Hits 2645 2642 -3
Misses 624 624
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Converts the
os.path.abspathandos.path.dirnamecalls whose pathlib equivalent behaves the same, and takes the vs2dt main source from the parent directory rather than from a".."segment thatabspathhad to normalize away.Four are deliberately kept and now carry a comment saying why:
pymake.pyandpymake_base.pycompareos.path.dirnameagainst a directory, and a target with no directory has to give""rather than the"."Path.parentgives.pymake.pyusesos.path.abspathas the key for the build targets list, where removing the".."segments is what makes two spellings of a target count as one._meson_build.pyneedsos.path.relpath, which has no pathlib equivalent before python 3.12.Verified by exercising
_update_vs2dt_fileson a source tree, and themfusgmakefile is byte identical.