git: bb8b0fac8417 - main - korean/py-korean-lunar-calendar: New port: Korean Lunar Calendar

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Mon, 26 Dec 2022 02:35:04 UTC
The branch main has been updated by yuri:

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

commit bb8b0fac8417439fefd31e67f88b3fde30746ff9
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-12-25 22:12:18 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-12-26 02:34:59 +0000

    korean/py-korean-lunar-calendar: New port: Korean Lunar Calendar
---
 korean/Makefile                               |  1 +
 korean/py-korean-lunar-calendar/Makefile      | 25 +++++++++++++++++++++
 korean/py-korean-lunar-calendar/distinfo      |  3 +++
 korean/py-korean-lunar-calendar/files/test.py | 31 +++++++++++++++++++++++++++
 korean/py-korean-lunar-calendar/pkg-descr     |  7 ++++++
 5 files changed, 67 insertions(+)

diff --git a/korean/Makefile b/korean/Makefile
index e789cf191ffe..32606b9788b3 100644
--- a/korean/Makefile
+++ b/korean/Makefile
@@ -41,6 +41,7 @@
     SUBDIR += nhpf
     SUBDIR += p5-Lingua-KO-Hangul-Util
     SUBDIR += p5-Lingua-KO-Romanize-Hangul
+    SUBDIR += py-korean-lunar-calendar
     SUBDIR += scim-hangul
     SUBDIR += scim-tables
     SUBDIR += sourcehansans-otf
diff --git a/korean/py-korean-lunar-calendar/Makefile b/korean/py-korean-lunar-calendar/Makefile
new file mode 100644
index 000000000000..a7b924968c4e
--- /dev/null
+++ b/korean/py-korean-lunar-calendar/Makefile
@@ -0,0 +1,25 @@
+PORTNAME=	korean-lunar-calendar
+DISTVERSION=	0.3.1
+CATEGORIES=	korean python
+MASTER_SITES=	CHEESESHOP
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+DISTNAME=	${PORTNAME:S/-/_/g}-${PORTVERSION}
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Korean Lunar Calendar
+WWW=		https://github.com/usingsky/korean_lunar_calendar_py
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		python:3.6+
+USE_PYTHON=	distutils autoplist pytest
+
+NO_ARCH=	yes
+
+TEST_ENV=	${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
+
+do-test:
+	@${SETENV} ${TEST_ENV} ${PYTHON_CMD} ${FILESDIR}/test.py
+
+.include <bsd.port.mk>
diff --git a/korean/py-korean-lunar-calendar/distinfo b/korean/py-korean-lunar-calendar/distinfo
new file mode 100644
index 000000000000..928988cfce4e
--- /dev/null
+++ b/korean/py-korean-lunar-calendar/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1672005953
+SHA256 (korean_lunar_calendar-0.3.1.tar.gz) = eb2c485124a061016926bdea6d89efdf9b9fdbf16db55895b6cf1e5bec17b857
+SIZE (korean_lunar_calendar-0.3.1.tar.gz) = 9877
diff --git a/korean/py-korean-lunar-calendar/files/test.py b/korean/py-korean-lunar-calendar/files/test.py
new file mode 100644
index 000000000000..66a1d25344e9
--- /dev/null
+++ b/korean/py-korean-lunar-calendar/files/test.py
@@ -0,0 +1,31 @@
+from korean_lunar_calendar import KoreanLunarCalendar
+
+calendar = KoreanLunarCalendar()
+# params : year(년), month(월), day(일)
+calendar.setSolarDate(2017, 6, 24)
+# Lunar Date (ISO Format)
+print(calendar.LunarIsoFormat())
+# Korean GapJa String
+print(calendar.getGapJaString())
+# Chinese GapJa String
+print(calendar.getChineseGapJaString())
+
+calendar = KoreanLunarCalendar()
+# params : year(년), month(월), day(일), intercalation(윤달여부)
+calendar.setLunarDate(1956, 1, 21, False)
+# Solar Date (ISO Format)
+print(calendar.SolarIsoFormat())
+# Korean GapJa String
+print(calendar.getGapJaString())
+# Chinese GapJa String
+print(calendar.getChineseGapJaString())
+
+calendar = KoreanLunarCalendar()
+
+# invald date
+calendar.setLunarDate(99, 1, 1, False) # => return False
+calendar.setSolarDate(2051, 1, 1) # => return False
+
+# OK
+calendar.setLunarDate(1000, 1, 1, False) # => return True
+calendar.setSolarDate(2050, 12, 31) # => return True
diff --git a/korean/py-korean-lunar-calendar/pkg-descr b/korean/py-korean-lunar-calendar/pkg-descr
new file mode 100644
index 000000000000..5b55e8f71aba
--- /dev/null
+++ b/korean/py-korean-lunar-calendar/pkg-descr
@@ -0,0 +1,7 @@
+korean-lunar-calendar is a library to convert Korean lunar-calendar to Gregorian
+calendar.
+
+Korean calendar and Chinese calendar is same lunar calendar but they have
+different dates.
+
+This package follows the KARI (Korea Astronomy and Space Science Institute).