mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 05:10:05 +02:00
freezegun, new python recipe (#8792)
This commit is contained in:
77
dev-python/freezegun/freezegun-1.2.2.recipe
Normal file
77
dev-python/freezegun/freezegun-1.2.2.recipe
Normal file
@@ -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
|
||||
}
|
||||
26
dev-python/freezegun/patches/397.patch
Normal file
26
dev-python/freezegun/patches/397.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
From e63874ce75a74a1159390914045fe8e7955b24c4 Mon Sep 17 00:00:00 2001
|
||||
From: Karthikeyan Singaravelan <tir.karthi@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:
|
||||
Reference in New Issue
Block a user