From 1270f32157b059c7a4ebaf91af886a95fc6657b7 Mon Sep 17 00:00:00 2001 From: Flaviu Tamas Date: Fri, 14 Sep 2018 13:49:33 -0400 Subject: [PATCH] Only build monotonic on py2 --- setup/build.py | 3 +++ setup/extensions.json | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/setup/build.py b/setup/build.py index 369c6f4c54..80f2629f93 100644 --- a/setup/build.py +++ b/setup/build.py @@ -27,6 +27,7 @@ class Extension(object): self.name = d['name'] = name self.sources = d['sources'] = absolutize(sources) self.needs_cxx = d['needs_cxx'] = bool([1 for x in self.sources if os.path.splitext(x)[1] in ('.cpp', '.c++', '.cxx')]) + self.needs_py2 = d['needs_py2'] = kwargs.get('needs_py2', False) self.headers = d['headers'] = absolutize(kwargs.get('headers', [])) self.sip_files = d['sip_files'] = absolutize(kwargs.get('sip_files', [])) self.inc_dirs = d['inc_dirs'] = absolutize(kwargs.get('inc_dirs', [])) @@ -262,6 +263,8 @@ class Build(Command): for ext in extensions: if opts.only != 'all' and opts.only != ext.name: continue + if ext.needs_py2 and sys.version_info >= (3,): + continue if ext.error: if ext.optional: self.warn(ext.error) diff --git a/setup/extensions.json b/setup/extensions.json index 95d136361e..a22f98df65 100644 --- a/setup/extensions.json +++ b/setup/extensions.json @@ -10,7 +10,8 @@ { "name": "monotonic", "sources": "calibre/utils/monotonic.c", - "linux_libraries": "rt" + "linux_libraries": "rt", + "needs_py2": true }, { "name": "unicode_names",