Properly hide PEP-632 warning on latest version of setuptools (#2251)

This commit is contained in:
Ofek Lev 2021-12-27 06:00:51 -05:00 committed by GitHub
parent 1431befa93
commit 12a1fc2860
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -152,7 +152,11 @@ class PythonInfo(object):
d = dist.Distribution({"script_args": "--no-user-cfg"}) # conf files not parsed so they do not hijack paths
if hasattr(sys, "_framework"):
sys._framework = None # disable macOS static paths for framework
i = d.get_command_obj("install", create=True)
with warnings.catch_warnings(): # disable warning for PEP-632
warnings.simplefilter("ignore")
i = d.get_command_obj("install", create=True)
i.prefix = os.sep # paths generated are relative to prefix that contains the path sep, this makes it relative
i.finalize_options()
result = {key: (getattr(i, "install_{}".format(key))[1:]).lstrip(os.sep) for key in SCHEME_KEYS}