Skip to content

Allow parsing Nodes as PathLike#4696

Merged
bdbaddog merged 2 commits intoSCons:masterfrom
Repiteo:pathlike
Apr 5, 2025
Merged

Allow parsing Nodes as PathLike#4696
bdbaddog merged 2 commits intoSCons:masterfrom
Repiteo:pathlike

Conversation

@Repiteo
Copy link
Contributor

@Repiteo Repiteo commented Mar 10, 2025

Adds __fspath__ to the Node class so they can be passed directly as pathlike arguments.

Contributor Checklist:

  • I have created a new test or updated the unit tests to cover the new/changed functionality.
  • I have updated CHANGES.txt and RELEASE.txt (and read the README.rst).
  • I have updated the appropriate documentation

@mwichmann
Copy link
Collaborator

This looks reasonable to me, after scanning through it in more detail than the first glance.

I'll want to think about where this has doc impacts, I think we talk about using str() to get the file name string somewhere. Being a PathLike object means that's handled for file-ish uses such open, checks like isdir, etc. but doesn't work when you need to get the string to do something else with (like printing for debug - that's the most frequent use by far in the docs). I see that came up a few times in the tests. Probably the Node Objects section.

@mwichmann
Copy link
Collaborator

Adding for reviewer reference - the protocol used came in via PEP 519, introduced in Python 3.6.

@mwichmann mwichmann added this to 4.10 Mar 27, 2025
@mwichmann mwichmann moved this to In progress in 4.10 Mar 27, 2025
@mwichmann mwichmann moved this from In progress to In review in 4.10 Mar 27, 2025
@bdbaddog bdbaddog merged commit 93033b3 into SCons:master Apr 5, 2025
6 of 8 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in 4.10 Apr 5, 2025
@Repiteo Repiteo deleted the pathlike branch April 6, 2025 13:04
@mwichmann mwichmann added this to the NextRelease milestone Apr 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants