Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Jun 2023 08:19:53 GMT
From:      Nicola Vitale <nivit@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: aadc486bfec5 - main - devel/py-time-machine: Add new port
Message-ID:  <202306170819.35H8Jrhh009952@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by nivit:

URL: https://cgit.FreeBSD.org/ports/commit/?id=aadc486bfec59c7d720d107f6758a4684c834236

commit aadc486bfec59c7d720d107f6758a4684c834236
Author:     Nicola Vitale <nivit@FreeBSD.org>
AuthorDate: 2023-06-17 08:17:31 +0000
Commit:     Nicola Vitale <nivit@FreeBSD.org>
CommitDate: 2023-06-17 08:19:46 +0000

    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
---
 devel/Makefile                  |  1 +
 devel/py-time-machine/Makefile  | 26 ++++++++++++++++++++++++++
 devel/py-time-machine/distinfo  |  3 +++
 devel/py-time-machine/pkg-descr |  7 +++++++
 4 files changed, 37 insertions(+)

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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202306170819.35H8Jrhh009952>