Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] Support os.PathLike objects #142

Open
taralx opened this issue May 16, 2022 · 4 comments
Open

[FR] Support os.PathLike objects #142

taralx opened this issue May 16, 2022 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@taralx
Copy link

taralx commented May 16, 2022

I prefer to use pathlib.Path objects, but helpers like distutils.Command.make_file only accept strings:

distutils/distutils/cmd.py

Lines 387 to 391 in 27638e3

if isinstance(infiles, str):
infiles = (infiles,)
elif not isinstance(infiles, (list, tuple)):
raise TypeError(
"'infiles' must be a string, or a list or tuple of strings")

Filing this issue before I go in and make a PR to change these to os.PathLike checks. Any issues with that approach?

Directed here from setuptools: pypa/setuptools#3315

@jaraco
Copy link
Member

jaraco commented Jun 6, 2022

Yes, I agree it would be preferable to support Pathlike objects natively. Where possible, I'd like for distutils to simply pass these values along rather than handle them explicitly. Feel free to prepare a PR.

@jaraco jaraco added enhancement New feature or request help wanted Extra attention is needed labels Jun 6, 2022
@taralx
Copy link
Author

taralx commented Jun 11, 2022

Do you mean that I should just remove the string checks?

@jaraco
Copy link
Member

jaraco commented Jul 1, 2022

Yes, I think so. See https://github.com/pypa/distutils/tree/refactor/142-allow-pathlike for how I might handle the situation.

@taralx
Copy link
Author

taralx commented Jul 1, 2022

Seems like your change is better than what I would have done. I'll take it and see where else the pattern should apply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants