commit:     f334193b0b7871740589dced59f3f5571f49d4ae
Author:     Julien Roy <julien <AT> jroy <DOT> ca>
AuthorDate: Wed May 15 16:52:10 2024 +0000
Commit:     Julien Roy <julien <AT> jroy <DOT> ca>
CommitDate: Wed May 15 16:55:16 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=f334193b

app-office/beancount: add 2.3.6, enable py3.12

Closes: https://bugs.gentoo.org/931358
Closes: https://bugs.gentoo.org/850412
Signed-off-by: Julien Roy <julien <AT> jroy.ca>

 app-office/beancount/Manifest               |   1 +
 app-office/beancount/beancount-2.3.6.ebuild | 112 ++++++++++++++++++++++++++++
 2 files changed, 113 insertions(+)

diff --git a/app-office/beancount/Manifest b/app-office/beancount/Manifest
index afb4ee6891..3f8cd19516 100644
--- a/app-office/beancount/Manifest
+++ b/app-office/beancount/Manifest
@@ -1 +1,2 @@
 DIST beancount-2.3.5.gh.tar.gz 1718715 BLAKE2B 
2bcbf250e6947c6ea93f7c4308fac2ea03c0b5b722dc4a6eb396133880ca201235ceb8cbb2e3a6e63afe573e1b3ab8bb945444a1edc73791b73200fb4d45bd18
 SHA512 
a3f1343ddf54cf13ef60802de210dc89e9ae202bca802b1b4eb532588f71d51fa4b71672b4e6a1e9676135d406fd55c421b80c439fa2f5f4279e61211f558a2a
+DIST beancount-2.3.6.gh.tar.gz 1720239 BLAKE2B 
769aa27a9edc201e33a85f92780b4140b1758a35ca865255183bdcaf4c515ba3bf4c6711aa2842c9219027a44a7cc334c39b48eb36f5145caa689ba90cda64d5
 SHA512 
52b65f99753e9473aae7736419d104e46b422b33f854170cc0242a95c1d12483aae95264138f81d28c9a7b50ca961e75163cce83868db5bcc9afe7d2337f3036

diff --git a/app-office/beancount/beancount-2.3.6.ebuild 
b/app-office/beancount/beancount-2.3.6.ebuild
new file mode 100644
index 0000000000..c49b53d487
--- /dev/null
+++ b/app-office/beancount/beancount-2.3.6.ebuild
@@ -0,0 +1,112 @@
+# Copyright 2021-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+DISTUTILS_USE_PEP517=setuptools
+DISTUTILS_SINGLE_IMPL=1
+
+inherit distutils-r1 toolchain-funcs
+
+DESCRIPTION="A double-entry accounting system that uses text files as input"
+HOMEPAGE="
+       https://beancount.github.io
+       https://github.com/beancount/beancount
+"
+SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.gh.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="
+       $(python_gen_cond_dep '
+               dev-python/beautifulsoup4[${PYTHON_USEDEP}]
+               dev-python/bottle[${PYTHON_USEDEP}]
+               dev-python/chardet[${PYTHON_USEDEP}]
+               dev-python/google-api-python-client[${PYTHON_USEDEP}]
+               dev-python/lxml[${PYTHON_USEDEP}]
+               dev-python/ply[${PYTHON_USEDEP}]
+               dev-python/python-dateutil[${PYTHON_USEDEP}]
+               dev-python/python-magic[${PYTHON_USEDEP}]
+               dev-python/requests[${PYTHON_USEDEP}]
+       ')
+"
+BDEPEND="
+       sys-devel/bison
+       sys-devel/flex
+"
+
+EPYTEST_DESELECT=( scripts/setup_test.py )
+
+distutils_enable_tests pytest
+
+src_prepare() {
+       distutils-r1_src_prepare
+
+       # remove test deps from 'install_requires'
+       sed "/pytest/d" -i setup.py || die
+
+       # we'll regenerate C sources
+       rm ${PN}/parser/grammar.{c,h} || die
+       rm ${PN}/parser/lexer.{c,h} || die
+
+       # repair tests
+       sed "/def find_repository_root/a\    return '${S}'" \
+               -i ${PN}/utils/test_utils.py || die
+       sed "s/\[PROGRAM\]/['${EPYTHON}', PROGRAM]/" \
+               -i ${PN}/tools/treeify_test.py || die
+       sed "/DATA_DIR =/c\    DATA_DIR = 
'${S}/${PN}/utils/file_type_testdata'" \
+               -i ${PN}/utils/file_type_test.py || die
+}
+
+src_configure() {
+       tc-export CC
+}
+
+python_compile() {
+       distutils-r1_python_compile
+
+       # keep in sync with hashsrc.py, otherwise expect test failures
+       local csources=(
+               decimal.{c,h}
+               grammar.y
+               lexer.l
+               macros.h
+               parser.{c,h}
+               tokens.h
+       )
+
+       for file in "${csources[@]}"; do
+               cp ${PN}/parser/${file} 
"${BUILD_DIR}"/install$(python_get_sitedir)/${PN}/parser || die
+       done
+}
+
+src_compile() {
+       local mymakeflags=(
+               PYCONFIG="$(python_get_PYTHON_CONFIG)"
+       )
+
+       emake "${mymakeflags[@]}" ${PN}/parser/grammar.c
+       emake "${mymakeflags[@]}" ${PN}/parser/lexer.c
+
+       distutils-r1_src_compile
+
+       use test && \
+               emake "${mymakeflags[@]}" ${PN}/parser/tokens_test
+}
+
+python_test(){
+       cd "${T}" || die
+       epytest --pyargs ${PN}
+}
+
+src_test() {
+       local mymakeflags=(
+               PYCONFIG="$(python_get_PYTHON_CONFIG)"
+       )
+
+       emake "${mymakeflags[@]}" ctest
+       distutils-r1_src_test
+}

Reply via email to