aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Vitale <nivit@FreeBSD.org>2023-06-17 08:17:31 +0000
committerNicola Vitale <nivit@FreeBSD.org>2023-06-17 08:19:46 +0000
commitaadc486bfec59c7d720d107f6758a4684c834236 (patch)
treedc6c4cac95b6bb85cc63a2933caa303622abbdb5
parentfec616976b07da3c6817bba47fe7d29d9317acbd (diff)
devel/py-time-machine: Add new port
time-machine, is intended to combine the advantages of freezegun and libfaketime Python modules. It works without LD_PRELOAD but still mocks the standard library functions everywhere they may be referenced. It does so by modifying the built-in functions at the C level, to point them through wrappers that return different values when mocking. Normally in Python, built-in functions are immutable, but time-machine overcomes this by using C code to replace their function pointers. https://github.com/adamchainz/time-machine
-rw-r--r--devel/Makefile1
-rw-r--r--devel/py-time-machine/Makefile26
-rw-r--r--devel/py-time-machine/distinfo3
-rw-r--r--devel/py-time-machine/pkg-descr7
4 files changed, 37 insertions, 0 deletions
diff --git a/devel/Makefile b/devel/Makefile
index a4827cd8881d..0d96c802863f 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -5605,6 +5605,7 @@
SUBDIR += py-thrift
SUBDIR += py-thriftpy2
SUBDIR += py-tiamat
+ SUBDIR += py-time-machine
SUBDIR += py-timelib
SUBDIR += py-timeout-decorator
SUBDIR += py-tinyarray
diff --git a/devel/py-time-machine/Makefile b/devel/py-time-machine/Makefile
new file mode 100644
index 000000000000..b18e41043a7e
--- /dev/null
+++ b/devel/py-time-machine/Makefile
@@ -0,0 +1,26 @@
+PORTNAME= time-machine
+DISTVERSION= 2.10.0
+CATEGORIES= devel python
+MASTER_SITES= PYPI
+PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
+DISTNAME= ${PORTNAME:S/-/_/1}-${PORTVERSION}
+
+MAINTAINER= nivit@FreeBSD.org
+COMMENT= Travel through time in your Python tests
+WWW= https://github.com/adamchainz/time-machine
+
+LICENSE= MIT
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}setuptools>=63.1.0:devel/py-setuptools@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}wheel>=0.40.0:devel/py-wheel@${PY_FLAVOR}
+RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}dateutil>=2.8.2:devel/py-dateutil@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}six>=1.5:devel/py-six@${PY_FLAVOR}
+
+USES= python
+USE_PYTHON= autoplist pep517
+
+post-install:
+ ${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/_time_machine${PYTHON_EXT_SUFFIX}.so
+
+.include <bsd.port.mk>
diff --git a/devel/py-time-machine/distinfo b/devel/py-time-machine/distinfo
new file mode 100644
index 000000000000..96ce92f2851e
--- /dev/null
+++ b/devel/py-time-machine/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1686987050
+SHA256 (time_machine-2.10.0.tar.gz) = 64fd89678cf589fc5554c311417128b2782222dd65f703bf248ef41541761da0
+SIZE (time_machine-2.10.0.tar.gz) = 28249
diff --git a/devel/py-time-machine/pkg-descr b/devel/py-time-machine/pkg-descr
new file mode 100644
index 000000000000..f4b7e989294f
--- /dev/null
+++ b/devel/py-time-machine/pkg-descr
@@ -0,0 +1,7 @@
+time-machine is intended to combine the advantages of freezegun and libfaketime
+Python modules. It works without LD_PRELOAD but still mocks the standard
+library functions everywhere they may be referenced. It does so by modifying
+the built-in functions at the C level, to point them through wrappers that
+return different values when mocking. Normally in Python, built-in functions
+are immutable, but time-machine overcomes this by using C code to replace their
+function pointers.