git: 0c69eeb8d5ad - main - misc/py-pdd: New port: Tiny date, time diff calculator with timers

From: Nuno Teixeira <eduardo_at_FreeBSD.org>
Date: Tue, 19 Nov 2024 10:47:35 UTC
The branch main has been updated by eduardo:

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

commit 0c69eeb8d5adb1b3c9ec665f00518887d6620365
Author:     Nuno Teixeira <eduardo@FreeBSD.org>
AuthorDate: 2024-11-19 10:26:15 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2024-11-19 10:28:25 +0000

    misc/py-pdd: New port: Tiny date, time diff calculator with timers
    
    pdd (Python3 Date Diff) is a tiny command line utility to calculate date
    and time difference. It can also be used as a timer. If no program
    arguments are specified it shows the current date, time and timezone.
    
    pdd has been written with only one goal - simplicity. Users shouldn't have
    to memorize anything.
    
    WWW: https://github.com/jarun/pdd
---
 misc/Makefile                   |  1 +
 misc/py-pdd/Makefile            | 34 ++++++++++++++++++++++++++++++++++
 misc/py-pdd/distinfo            |  3 +++
 misc/py-pdd/files/patch-test.py | 39 +++++++++++++++++++++++++++++++++++++++
 misc/py-pdd/pkg-descr           |  6 ++++++
 5 files changed, 83 insertions(+)

diff --git a/misc/Makefile b/misc/Makefile
index d898ca577e25..af986f077736 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -484,6 +484,7 @@
     SUBDIR += py-oterm
     SUBDIR += py-palettable
     SUBDIR += py-papermill
+    SUBDIR += py-pdd
     SUBDIR += py-pexpect
     SUBDIR += py-pkbar
     SUBDIR += py-placekey
diff --git a/misc/py-pdd/Makefile b/misc/py-pdd/Makefile
new file mode 100644
index 000000000000..4961681cb630
--- /dev/null
+++ b/misc/py-pdd/Makefile
@@ -0,0 +1,34 @@
+PORTNAME=	pdd
+DISTVERSIONPREFIX=	v
+DISTVERSION=	1.7
+CATEGORIES=	misc python
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	eduardo@FreeBSD.org
+COMMENT=	Tiny date, time diff calculator with timers
+WWW=		https://github.com/jarun/pdd
+
+LICENSE=	GPLv3+
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	${PY_SETUPTOOLS} \
+		${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR}
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}python-dateutil>0:devel/py-python-dateutil@${PY_FLAVOR}
+TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pytest>=0:devel/py-pytest@${PY_FLAVOR}
+
+USES=		python
+USE_GITHUB=	yes
+GH_ACCOUNT=	jarun
+USE_PYTHON=	autoplist pep517
+
+NO_ARCH=	yes
+
+PLIST_FILES=	share/man/man1/${PORTNAME}.1.gz
+
+post-install:
+	${INSTALL_MAN} ${WRKSRC}/${PORTNAME}.1 ${STAGEDIR}${PREFIX}/share/man/man1
+
+do-test:
+	cd ${WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m pytest -v test.py
+
+.include <bsd.port.mk>
diff --git a/misc/py-pdd/distinfo b/misc/py-pdd/distinfo
new file mode 100644
index 000000000000..87220a14c4ad
--- /dev/null
+++ b/misc/py-pdd/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1732006131
+SHA256 (jarun-pdd-v1.7_GH0.tar.gz) = a81adcac025b08c7c933f028339c55a67d0da6c81845fe3d18fd4187010a63d4
+SIZE (jarun-pdd-v1.7_GH0.tar.gz) = 26905
diff --git a/misc/py-pdd/files/patch-test.py b/misc/py-pdd/files/patch-test.py
new file mode 100644
index 000000000000..7652b4b901de
--- /dev/null
+++ b/misc/py-pdd/files/patch-test.py
@@ -0,0 +1,39 @@
+--- test.py.orig	2024-11-19 09:24:59 UTC
++++ test.py
+@@ -17,21 +17,21 @@ test = [
+ import subprocess
+ 
+ test = [
+-    ('./pdd', '-d', '1983', 'jul', '3', '2014', '1', '15'),               # 1
+-    ('./pdd', '-d', '2014', '1', '15', '1983', 'jul', '03'),              # 2
+-    ('./pdd', '-t', '45:50', '6:17:33'),                                  # 3
+-    ('./pdd', '-t', '6:17:33', '45:50'),                                  # 4
+-    ('./pdd', '-t', '5:80:75', '6:17:33'),                                # 5
+-    ('./pdd', '-t', '6:17:33', '5:80:75'),                                # 6
+-    ('./pdd', '-d', '2000', 'FEB', '28', '3', '2', '1', '--add'),         # 7
+-    ('./pdd', '-d', '2000', 'FEB', '28', '1', '2', '3', '--add'),         # 8
+-    ('./pdd', '-t', '47:71:37', '1:2:63', '--add'),                       # 9
+-    ('./pdd', '-d', '2000', 'Mar', '01', '0', '0', '1', '--sub'),         # 10
+-    ('./pdd', '-d', '2000', 'Mar', '1', '1', '1', '1', '--sub'),          # 11
+-    ('./pdd', '-t', '00:00:00', '0:0:1', '--sub'),                        # 12
+-    ('./pdd', '-t', '25:61:61', '0:0:0', '--sub'),                        # 13
+-    ('./pdd', '-t', '0:0:0', '1:1:1', '--sub'),                           # 14
+-    ('./pdd', '-t', '0:0:0', '25:61:61', '--sub'),                        # 15
++    ('pdd', '-d', '1983', 'jul', '3', '2014', '1', '15'),               # 1
++    ('pdd', '-d', '2014', '1', '15', '1983', 'jul', '03'),              # 2
++    ('pdd', '-t', '45:50', '6:17:33'),                                  # 3
++    ('pdd', '-t', '6:17:33', '45:50'),                                  # 4
++    ('pdd', '-t', '5:80:75', '6:17:33'),                                # 5
++    ('pdd', '-t', '6:17:33', '5:80:75'),                                # 6
++    ('pdd', '-d', '2000', 'FEB', '28', '3', '2', '1', '--add'),         # 7
++    ('pdd', '-d', '2000', 'FEB', '28', '1', '2', '3', '--add'),         # 8
++    ('pdd', '-t', '47:71:37', '1:2:63', '--add'),                       # 9
++    ('pdd', '-d', '2000', 'Mar', '01', '0', '0', '1', '--sub'),         # 10
++    ('pdd', '-d', '2000', 'Mar', '1', '1', '1', '1', '--sub'),          # 11
++    ('pdd', '-t', '00:00:00', '0:0:1', '--sub'),                        # 12
++    ('pdd', '-t', '25:61:61', '0:0:0', '--sub'),                        # 13
++    ('pdd', '-t', '0:0:0', '1:1:1', '--sub'),                           # 14
++    ('pdd', '-t', '0:0:0', '25:61:61', '--sub'),                        # 15
+ ]
+ 
+ res = [
diff --git a/misc/py-pdd/pkg-descr b/misc/py-pdd/pkg-descr
new file mode 100644
index 000000000000..0003b1ffacd6
--- /dev/null
+++ b/misc/py-pdd/pkg-descr
@@ -0,0 +1,6 @@
+pdd (Python3 Date Diff) is a tiny command line utility to calculate date
+and time difference. It can also be used as a timer. If no program
+arguments are specified it shows the current date, time and timezone.
+
+pdd has been written with only one goal - simplicity. Users shouldn't have
+to memorize anything.