-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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] distutils.errors.* is not fully re-exported #2698
Labels
Comments
QuLogic
added
enhancement
Needs Triage
Issues that need to be evaluated for severity and status.
labels
Jun 16, 2021
1 task
I had this same question regarding use of this in scikit-image's setup.py. What is the recommended path forward here? ( |
abravalheri
added a commit
to abravalheri/setuptools
that referenced
this issue
Nov 5, 2021
As mentioned in pypa#2698, exposing distutil errors via setuptools help the migration stated by PEP 632.
XuanWang-Amos
added a commit
to grpc/grpc
that referenced
this issue
Sep 6, 2023
### Background * `distutils` is deprecated with removal planned for Python 3.12 ([pep-0632](https://peps.python.org/pep-0632/)), thus we're trying to replace all distutils usage with setuptools. * Please note that user still have access to `distutils` if setuptools is installed and `SETUPTOOLS_USE_DISTUTILS` is set to `local` (The default in setuptools, more details can be found [in this discussion](pypa/setuptools#2806 (comment))). ### How we decide the replacement * We're following setuptools [Porting from Distutils guide](https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html#porting-from-distutils) when deciding the replacement. #### Replacement not mentioned in the guide * Replaced `distutils.utils.get_platform()` with `sysconfig.get_platform()`. * Based on the [answer here](https://stackoverflow.com/questions/71664875/what-is-the-replacement-for-distutils-util-get-platform), and also checked the document that `sysconfig.get_platform()` is good enough for our use cases. * Replaced `DistutilsOptionError` with `OptionError`. * `setuptools.error` is exporting it as `OptionError` [in the code](https://github.com/pypa/setuptools/blob/v59.6.0/setuptools/errors.py). * Upgrade `setuptools` in `test_packages.sh` and changed the version ping to `59.6.0` in `build_artifact_python.bat`. * `distutils.errors.*` is not fully re-exported until `59.0.0` (See [this issue](pypa/setuptools#2698) for more details). ### Changes not included in this PR * We're patching some compiler related functions provided by distutils in our code ([example](https://github.com/grpc/grpc/blob/ee4efc31c1dde7389ece70ba908049d7baeb9c65/src/python/grpcio/_spawn_patch.py#L30)), but since `setuptools` doesn't have similar interface (See [this issue for more details](pypa/setuptools#2806)), we don't have a clear path to replace them yet. <!-- If you know who should review your pull request, please assign it to that person, otherwise the pull request would get assigned randomly. If your pull request is for a specific language, please add the appropriate lang label. -->
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
What's the problem this feature will solve?
The Migration Advice in PEP 0632 says that
setuptools
is a sufficient replacement fordistutils.errors
. However, onlyDistutilsError
andRemovedCommandError
exist there. Indistutils
, there are:While all of the
Distutils
-prefixed ones derive fromDistutilsError
, the ones without the prefix are derived fromCCompilerError
, and so cannot be caught using anything exported bysetuptools
. Concretely, this makes it difficult to check for compiler flags, as done here.Describe the solution you'd like
Re-export all
distutils.errors.*
insetuptools.errors
.Alternative Solutions
Currently, we use
distutils.errors
, but won't be able to after Python 3.12. One can use a genericException
too, but that's not recommended.Or as a complete alternative, if
setuptools
had a way to check whether a compiler supported a flag in a builtin way, then we wouldn't need to catch theCompileError
ourselves.Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: