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 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).