remove python2, don't support python2 anymore

This commit is contained in:
eaglegai 2020-10-29 10:00:05 +08:00
parent 054a18003a
commit 3523083652
2 changed files with 8 additions and 113 deletions

View File

@ -1,74 +0,0 @@
From 7c376b485111183414ba4cb8a567bee8e56c888d Mon Sep 17 00:00:00 2001
From: eaglegai <eaglegai@163.com>
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

View File

@ -1,28 +1,16 @@
Name: pycairo Name: pycairo
Version: 1.19.1 Version: 1.19.1
Release: 1 Release: 2
Summary: A python module providing bindings for the cairo graphics library Summary: A python module providing bindings for the cairo graphics library
License: MPLv1.1 or LGPLv2 License: MPLv1.1 or LGPLv2
URL: https://cairographics.org/pycairo URL: https://cairographics.org/pycairo
Source0: https://github.com/pygobject/pycairo/releases/download/v%{version}/pycairo-%{version}.tar.gz Source0: https://github.com/pygobject/pycairo/releases/download/v%{version}/pycairo-%{version}.tar.gz
#Just a temporary patch,after whole branch removing python2,remove it BuildRequires: cairo-devel gcc pkgconfig python3-devel python3-pytest
Patch0001: fix-building-error-with-python2.patch
BuildRequires: cairo-devel gcc pkgconfig python2-devel python2-pytest python3-devel python3-pytest
%description %description
Pycairo is a Python module providing bindings for the cairo graphics library. Pycairo is a Python module providing bindings for the cairo graphics library.
%package -n python2-cairo
Summary: Provide python2 support for the cairo graphics library
%{?python_provide:%python_provide python2-cairo}
Obsoletes: pycairo
Provides: pycairo = %{version}-%{release}
%description -n python2-cairo
Provide python2 support for the cairo graphics library.
%package -n python3-cairo %package -n python3-cairo
Summary: Provide python3 support for the cairo graphics library Summary: Provide python3 support for the cairo graphics library
%{?python_provide:%python_provide python3-cairo} %{?python_provide:%python_provide python3-cairo}
@ -30,17 +18,6 @@ Summary: Provide python3 support for the cairo graphics library
%description -n python3-cairo %description -n python3-cairo
Provide python3 support for the cairo graphics library. Provide python3 support for the cairo graphics library.
%package -n python2-cairo-devel
Summary: Provide libraries and header files for pycairo
Requires: python2-cairo = %{version}-%{release}
Requires: python2-devel
Obsoletes: pycairo-devel
Provides: pycairo-devel = %{version}-%{release}
%description -n python2-cairo-devel
This package contains files required to build wrappers for cairo add-on
libraries so that they interoperate with pycairo.
%package -n python3-cairo-devel %package -n python3-cairo-devel
Summary: Provide libraries and headers for py3cairo Summary: Provide libraries and headers for py3cairo
Requires: python3-cairo = %{version}-%{release} Requires: python3-cairo = %{version}-%{release}
@ -54,40 +31,32 @@ in order to interoperate with py3cairo.
%autosetup -n %{name}-%{version} -p1 %autosetup -n %{name}-%{version} -p1
%build %build
%py2_build
%py3_build %py3_build
%install %install
%py2_install
%py3_install %py3_install
%check %check
%{__python2} setup.py test
%{__python3} setup.py test %{__python3} setup.py test
%files -n python2-cairo
%defattr(-,root,root)
%license COPYING*
%{python2_sitearch}/cairo/*
%{python2_sitearch}/pycairo*.egg-info/*
%files -n python3-cairo %files -n python3-cairo
%defattr(-,root,root) %defattr(-,root,root)
%license COPYING* %license COPYING*
%{python3_sitearch}/cairo/* %{python3_sitearch}/cairo/*
%{python3_sitearch}/pycairo*.egg-info/* %{python3_sitearch}/pycairo*.egg-info/*
%files -n python2-cairo-devel
%defattr(-,root,root)
%{_includedir}/pycairo/pycairo.h
%{_libdir}/pkgconfig/py*.pc
%files -n python3-cairo-devel %files -n python3-cairo-devel
%defattr(-,root,root) %defattr(-,root,root)
%{_includedir}/pycairo/py3cairo.h %{_includedir}/pycairo/py3cairo.h
%{_libdir}/pkgconfig/py*.pc %{_libdir}/pkgconfig/py*.pc
%changelog %changelog
* Thu Oct 29 2020 gaihuiying <gaihuiying1@huawei.com> - 1.19.1-2
- Type:requirement
- ID:NA
- SUG:NA
- DESC:remove python2
* Wed Jul 29 2020 gaihuiying <gaihuiying1@huawei.com> - 1.19.1-1 * Wed Jul 29 2020 gaihuiying <gaihuiying1@huawei.com> - 1.19.1-1
- Type:requirement - Type:requirement
- ID:NA - ID:NA