summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorAntoine Pitrou <pitrou@free.fr>2017-09-28 21:03:06 (GMT)
committerGitHub <noreply@github.com>2017-09-28 21:03:06 (GMT)
commita106aec2ed6ba171838ca7e6ba43c4e722bbecd1 (patch)
tree2a242b9061198d40f40d2921818e6da8089a9b50 /setup.py
parent8d59aca4a953b097a9b02b0ecafef840e4ac5855 (diff)
downloadcpython-a106aec2ed6ba171838ca7e6ba43c4e722bbecd1.zip
cpython-a106aec2ed6ba171838ca7e6ba43c4e722bbecd1.tar.gz
cpython-a106aec2ed6ba171838ca7e6ba43c4e722bbecd1.tar.bz2
bpo-11063, bpo-20519: avoid ctypes and improve import time for uuid (#3796)
bpo-11063, bpo-20519: avoid ctypes and improve import time for uuid.
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index d5c58e0..0b536c8 100644
--- a/setup.py
+++ b/setup.py
@@ -1668,6 +1668,20 @@ class PyBuildExt(build_ext):
if '_tkinter' not in [e.name for e in self.extensions]:
missing.append('_tkinter')
+ # Build the _uuid module if possible
+ uuid_incs = find_file("uuid.h", inc_dirs, ["/usr/include/uuid"])
+ if uuid_incs:
+ if self.compiler.find_library_file(lib_dirs, 'uuid'):
+ uuid_libs = ['uuid']
+ else:
+ uuid_libs = []
+ if uuid_incs:
+ self.extensions.append(Extension('_uuid', ['_uuidmodule.c'],
+ libraries=uuid_libs,
+ include_dirs=uuid_incs))
+ else:
+ missing.append('_uuid')
+
## # Uncomment these lines if you want to play with xxmodule.c
## ext = Extension('xx', ['xxmodule.c'])
## self.extensions.append(ext)