distutils icon indicating copy to clipboard operation
distutils copied to clipboard

[FR] Support os.PathLike objects

Open taralx opened this issue 3 years ago • 4 comments

I prefer to use pathlib.Path objects, but helpers like distutils.Command.make_file only accept strings: https://github.com/pypa/distutils/blob/27638e388d8ae92368e5459254b59a026e73b1cd/distutils/cmd.py#L387-L391

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: https://github.com/pypa/setuptools/issues/3315

taralx avatar May 16 '22 16:05 taralx

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 avatar Jun 06 '22 00:06 jaraco

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

taralx avatar Jun 11 '22 19:06 taralx

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

jaraco avatar Jul 01 '22 19:07 jaraco

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

taralx avatar Jul 01 '22 22:07 taralx