diff --git a/dev-python/freezegun/freezegun-1.2.2.recipe b/dev-python/freezegun/freezegun-1.2.2.recipe new file mode 100644 index 000000000..58d183b1c --- /dev/null +++ b/dev-python/freezegun/freezegun-1.2.2.recipe @@ -0,0 +1,77 @@ +SUMMARY="Let your Python tests travel through time" +DESCRIPTION="FreezeGun is a library that allows your Python tests to travel through time by \ +mocking the datetime module." +HOMEPAGE="https://github.com/spulec/freezegun" +COPYRIGHT="2023 Steve Pulec" +LICENSE="Apache v2" +REVISION="1" +SOURCE_URI="https://pypi.python.org/packages/source/f/$portName/$portName-$portVersion.tar.gz" +CHECKSUM_SHA256="cd22d1ba06941384410cd967d8a99d5ae2442f57dfafeff2fda5de8dc5c05446" +PATCHES="397.patch" # from upstream + +ARCHITECTURES="any" + +PROVIDES=" + $portName = $portVersion + " +REQUIRES=" + haiku + " + +BUILD_REQUIRES=" + haiku_devel + " + +PYTHON_PACKAGES=(python39 python310) +PYTHON_VERSIONS=(3.9 3.10) +defaultTestVersion="python39" +for i in "${!PYTHON_PACKAGES[@]}"; do + pythonPackage=${PYTHON_PACKAGES[i]} + pythonVersion=${PYTHON_VERSIONS[$i]} + + eval "PROVIDES_$pythonPackage=\" + ${portName}_$pythonPackage = $portVersion + \"" + eval "REQUIRES_$pythonPackage=\" + haiku + dateutil_$pythonPackage + cmd:python$pythonVersion + \"" + BUILD_REQUIRES+=" + setuptools_$pythonPackage + " + BUILD_PREREQUIRES+=" + cmd:python$pythonVersion + " +done + +TEST_REQUIRES=" + dateutil_$defaultTestVersion + cmd:pytest + " + +INSTALL() +{ + for i in "${!PYTHON_PACKAGES[@]}"; do + pythonPackage=${PYTHON_PACKAGES[i]} + pythonVersion=${PYTHON_VERSIONS[$i]} + + python=python$pythonVersion + installLocation=$prefix/lib/$python/vendor-packages/ + export PYTHONPATH=$installLocation:$PYTHONPATH + + mkdir -p $installLocation + rm -rf build + + $python setup.py build install \ + --root=/ --prefix=$prefix + + packageEntries $pythonPackage \ + $prefix/lib/python* + done +} + +TEST() +{ + pytest -v +} diff --git a/dev-python/freezegun/patches/397.patch b/dev-python/freezegun/patches/397.patch new file mode 100644 index 000000000..53f67f32e --- /dev/null +++ b/dev-python/freezegun/patches/397.patch @@ -0,0 +1,26 @@ +From e63874ce75a74a1159390914045fe8e7955b24c4 Mon Sep 17 00:00:00 2001 +From: Karthikeyan Singaravelan +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: