[3.9] bpo-43158: Use configure values for building _uuid extension (GH-29353) (GH-29363)

Co-authored-by: Christian Heimes <christian@python.org>
This commit is contained in:
Miss Islington (bot) 2021-11-02 04:52:42 -07:00 committed by GitHub
parent da04bef5f7
commit 91a51c5ffc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 86 additions and 7 deletions

View file

@ -1770,15 +1770,15 @@ class PyBuildExt(build_ext):
def detect_uuid(self):
# Build the _uuid module if possible
uuid_incs = find_file("uuid.h", self.inc_dirs, ["/usr/include/uuid"])
if uuid_incs is not None:
if self.compiler.find_library_file(self.lib_dirs, 'uuid'):
uuid_libs = ['uuid']
uuid_h = sysconfig.get_config_var("HAVE_UUID_H")
uuid_uuid_h = sysconfig.get_config_var("HAVE_UUID_UUID_H")
if uuid_h or uuid_uuid_h:
if sysconfig.get_config_var("HAVE_LIBUUID"):
uuid_libs = ["uuid"]
else:
uuid_libs = []
self.add(Extension('_uuid', ['_uuidmodule.c'],
libraries=uuid_libs,
include_dirs=uuid_incs))
libraries=uuid_libs))
else:
self.missing.append('_uuid')