Skip to content

Instantly share code, notes, and snippets.

@dmoisset
Last active July 6, 2020 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmoisset/c33de64f4a93417e8f46726f58c99283 to your computer and use it in GitHub Desktop.
Save dmoisset/c33de64f4a93417e8f46726f58c99283 to your computer and use it in GitHub Desktop.
# based on https://github.com/python/cpython/blob/9538bc9185e934bee2bd5ae2cda2b2e92a61906d/Lib/distutils/command/build_ext.py#L357-L385
match ext:
case Extension():
continue
case tuple((str(ext_name), {"sources": build_src})) if extension_name_re.match(ext_name):
log.warn("old-style (ext_name, build_info) tuple found in "
"ext_modules for extension '%s' "
"-- please convert to Extension instance", ext_name)
ext = Extension(ext_name, build_src)
case _:
raise DistutilsSetupError(
"each element of 'ext_modules' option must be an "
"Extension instance or (string, dict) tuple")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment