commit ee1d6d13280727d17ce05ae8d1b57a737fbfb74d Author: Jakub Bogusz <qbo...@pld-linux.org> Date: Mon Oct 23 21:17:35 2023 +0200
- updated to 1.2.2 + PR to fix staticmethods with python3.10 freezegun-pull397.patch | 26 +++++++++++ python-freezegun.spec | 119 ------------------------------------------------ python3-freezegun.spec | 63 +++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 119 deletions(-) --- diff --git a/python-freezegun.spec b/python-freezegun.spec deleted file mode 100644 index 3d56780..0000000 --- a/python-freezegun.spec +++ /dev/null @@ -1,119 +0,0 @@ -# -# Conditional build: -%bcond_without tests # unit tests -%bcond_without python2 # CPython 2.x module -%bcond_without python3 # CPython 3.x module - -Summary: FreezeGun: Let your Python 2 tests travel through time -Summary(pl.UTF-8): FreezeGun - umożliwienie testom Pythona 2 podróżowania w czasie -Name: python-freezegun -# keep 0.3.x here for python3 support -Version: 0.3.15 -Release: 5 -License: Apache v2.0 -Group: Libraries/Python -#Source0Download: https://pypi.org/simple/freezegun/ -Source0: https://files.pythonhosted.org/packages/source/f/freezegun/freezegun-%{version}.tar.gz -# Source0-md5: 20d32ddc33d79bf53b6029a265ed2fcc -URL: https://pypi.org/project/freezegun/ -BuildRequires: rpm-pythonprov -BuildRequires: rpmbuild(macros) >= 1.714 -%if %{with python2} -BuildRequires: python-modules >= 1:2.7 -BuildRequires: python-setuptools -%if %{with tests} -BuildRequires: python-dateutil >= 2.1 -BuildRequires: python-mock -BuildRequires: python-modules-sqlite -BuildRequires: python-pytest -BuildRequires: python-six -%endif -%endif -%if %{with python3} -BuildRequires: python3-modules >= 1:3.5 -BuildRequires: python3-setuptools -%if %{with tests} -BuildRequires: python3-dateutil >= 2.1 -BuildRequires: python3-pytest -BuildRequires: python3-six -%endif -%endif -Requires: python-modules >= 1:2.7 -BuildArch: noarch -BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) - -%description -FreezeGun is a library that allows your Python tests to travel through -time by mocking the datetime module. - -%description -l pl.UTF-8 -FreezeGun to biblioteka pozwalająca testom w Pythonie podróżowanie w -czasie dzięki atrapie modułu datetime. - -%package -n python3-freezegun -Summary: FreezeGun: Let your Python 3 tests travel through time -Summary(pl.UTF-8): FreezeGun - umożliwienie testom Pythona 3 podróżowania w czasie -Group: Libraries/Python -Requires: python3-modules >= 1:3.5 - -%description -n python3-freezegun -FreezeGun is a library that allows your Python tests to travel through -time by mocking the datetime module. - -%description -n python3-freezegun -l pl.UTF-8 -FreezeGun to biblioteka pozwalająca testom w Pythonie podróżowanie w -czasie dzięki atrapie modułu datetime. - -%prep -%setup -q -n freezegun-%{version} - -%build -%if %{with python2} -%py_build - -%if %{with tests} -PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ -%{__python} -m pytest tests -%endif -%endif - -%if %{with python3} -%py3_build - -%if %{with tests} -PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ -%{__python3} -m pytest tests -%endif -%endif - -%install -rm -rf $RPM_BUILD_ROOT - -%if %{with python2} -%py_install - -%py_postclean -%endif - -%if %{with python3} -%py3_install -%endif - -%clean -rm -rf $RPM_BUILD_ROOT - -%if %{with python2} -%files -%defattr(644,root,root,755) -%doc AUTHORS.rst CHANGELOG README.rst -%{py_sitescriptdir}/freezegun -%{py_sitescriptdir}/freezegun-%{version}-py*.egg-info -%endif - -%if %{with python3} -%files -n python3-freezegun -%defattr(644,root,root,755) -%doc AUTHORS.rst CHANGELOG README.rst -%{py3_sitescriptdir}/freezegun -%{py3_sitescriptdir}/freezegun-%{version}-py*.egg-info -%endif diff --git a/python3-freezegun.spec b/python3-freezegun.spec new file mode 100644 index 0000000..0ca08ae --- /dev/null +++ b/python3-freezegun.spec @@ -0,0 +1,63 @@ +# +# Conditional build: +%bcond_without tests # unit tests + +Summary: FreezeGun: Let your Python 2 tests travel through time +Summary(pl.UTF-8): FreezeGun - umożliwienie testom Pythona 2 podróżowania w czasie +Name: python3-freezegun +Version: 1.2.2 +Release: 1 +License: Apache v2.0 +Group: Libraries/Python +#Source0Download: https://pypi.org/simple/freezegun/ +Source0: https://files.pythonhosted.org/packages/source/f/freezegun/freezegun-%{version}.tar.gz +# Source0-md5: 40e783f950f4e17e1e0118dd6385b449 +# https://patch-diff.githubusercontent.com/raw/spulec/freezegun/pull/397.patch +Patch0: freezegun-pull397.patch +URL: https://pypi.org/project/freezegun/ +BuildRequires: python3-modules >= 1:3.7 +BuildRequires: python3-setuptools +%if %{with tests} +BuildRequires: python3-dateutil >= 2.7 +BuildRequires: python3-pytest +%endif +BuildRequires: rpm-pythonprov +BuildRequires: rpmbuild(macros) >= 1.714 +Requires: python3-modules >= 1:3.7 +BuildArch: noarch +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) + +%description +FreezeGun is a library that allows your Python tests to travel through +time by mocking the datetime module. + +%description -l pl.UTF-8 +FreezeGun to biblioteka pozwalająca testom w Pythonie podróżowanie w +czasie dzięki atrapie modułu datetime. + +%prep +%setup -q -n freezegun-%{version} +%patch0 -p1 + +%build +%py3_build + +%if %{with tests} +PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ +PYTHONPATH=$(pwd) \ +%{__python3} -m pytest tests +%endif + +%install +rm -rf $RPM_BUILD_ROOT + +%py3_install + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(644,root,root,755) +%doc AUTHORS.rst CHANGELOG README.rst +%{py3_sitescriptdir}/freezegun +%{py3_sitescriptdir}/freezegun-%{version}-py*.egg-info diff --git a/freezegun-pull397.patch b/freezegun-pull397.patch new file mode 100644 index 0000000..53f67f3 --- /dev/null +++ b/freezegun-pull397.patch @@ -0,0 +1,26 @@ +From e63874ce75a74a1159390914045fe8e7955b24c4 Mon Sep 17 00:00:00 2001 +From: Karthikeyan Singaravelan <tir.kar...@gmail.com> +Date: Fri, 7 May 2021 15:51:33 +0000 +Subject: [PATCH] Fix decorate_class for Python 3.10 where staticmethod is + callable. + +--- + freezegun/api.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/freezegun/api.py b/freezegun/api.py +index cab9ebe..55a80c7 100644 +--- a/freezegun/api.py ++++ b/freezegun/api.py +@@ -598,7 +598,10 @@ def tearDownClass(cls): + continue + seen.add(attr) + +- if not callable(attr_value) or inspect.isclass(attr_value): ++ # staticmethods are callable from Python 3.10 . Hence skip them from decoration ++ if (not callable(attr_value) ++ or inspect.isclass(attr_value) ++ or isinstance(attr_value, staticmethod)): + continue + + try: ================================================================ ---- gitweb: http://git.pld-linux.org/gitweb.cgi/packages/python3-freezegun.git/commitdiff/ee1d6d13280727d17ce05ae8d1b57a737fbfb74d _______________________________________________ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit