From 7c376b485111183414ba4cb8a567bee8e56c888d Mon Sep 17 00:00:00 2001 From: eaglegai Date: Wed, 29 Jul 2020 10:44:33 +0800 Subject: [PATCH] fix building error with python2 --- docs/conf.py | 1 + meson.build | 4 ++-- setup.py | 8 +++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index b3925ee..be0a886 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -5,6 +5,7 @@ extensions = [ 'sphinx.ext.extlinks', ] intersphinx_mapping = { + 'python': ('https://docs.python.org/2', None), 'python3': ('https://docs.python.org/3', None), } source_suffix = '.rst' diff --git a/meson.build b/meson.build index c724096..25e2b1a 100644 --- a/meson.build +++ b/meson.build @@ -14,8 +14,8 @@ pymod = import('python') python = pymod.find_installation(get_option('python')) pyver = python.language_version() -if pyver.version_compare('< 3.5') - error('Requires Python >= 3.5') +if pyver.version_compare('< 2.7') or (pyver.version_compare('>= 3.0') and pyver.version_compare('< 3.5')) + error('Requires Python 2.7 or Python >= 3.5') endif configure_file( diff --git a/setup.py b/setup.py index 2046553..580260f 100755 --- a/setup.py +++ b/setup.py @@ -531,8 +531,8 @@ class build(du_build): def main(): - if sys.version_info[0] < 3: - raise Exception("Python 2 no longer supported") +# if sys.version_info[0] < 3: +# raise Exception("Python 2 no longer supported") cairo_ext = Extension( name='cairo._cairo', @@ -600,6 +600,8 @@ def main(): }, classifiers=[ 'Operating System :: OS Independent', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', @@ -612,7 +614,7 @@ def main(): 'License :: OSI Approved :: Mozilla Public License 1.1 (MPL 1.1)', ], cmdclass=cmdclass, - python_requires='>=3.5, <4', + python_requires='>=2.7, <4', ) -- 1.8.3.1