diff options
Diffstat (limited to 'app-i18n/opencc')
-rw-r--r-- | app-i18n/opencc/Manifest | 7 | ||||
-rw-r--r-- | app-i18n/opencc/files/opencc-1.1.9-python.patch | 162 | ||||
-rw-r--r-- | app-i18n/opencc/opencc-1.1.4.ebuild | 69 | ||||
-rw-r--r-- | app-i18n/opencc/opencc-1.1.7-r2.ebuild (renamed from app-i18n/opencc/opencc-1.1.7-r1.ebuild) | 4 | ||||
-rw-r--r-- | app-i18n/opencc/opencc-1.1.9.ebuild | 122 |
5 files changed, 288 insertions, 76 deletions
diff --git a/app-i18n/opencc/Manifest b/app-i18n/opencc/Manifest index 9e65c53185b2..77d8416741bb 100644 --- a/app-i18n/opencc/Manifest +++ b/app-i18n/opencc/Manifest @@ -1,7 +1,8 @@ AUX opencc-1.1.7-fix-missing-cstdint-for-gcc-15.patch 247 BLAKE2B 3d7bc564a2143d08cd290bde2d371ca1d1cc8f7ef884455329658d9cc98165048a71bcfb3386664cc14dea5770f3434108c7af9242dca9db9de34cdfa84a2a01 SHA512 0d3cd2f4a994c0ee9a64a93ed2e5adc030502f9fed2b66584287a4542a35e7e8702b7746b263a3d3f3a2b5e3957af171440fe115ffbaecb03481d9ecd7d750dc -DIST opencc-1.1.4.tar.gz 2806887 BLAKE2B 150fd83818616de42e535f349b2574ff3319e41618e522583a57a00ab08b7f28db6e8f4fa4a0d4dbe027753b5be87065b2015542251986c6301ad441c4bf4c98 SHA512 ab8e7e6a0cc71106cf09eb32899fa8620b946a406f042d75a2444096e0b383cb1993d6c2d12cd7862e71854da4cd5893442bce51df84c32ed09fdfb4a2846f46 +AUX opencc-1.1.9-python.patch 5249 BLAKE2B bf5e9dbc7dbad22e9939304c834a34f32f5216a4dabd3016b0346741af316f1a326fc137354c2debd5d2fcf8b0fe1d06944d773f2cf2843f1cb6b2660bce66a6 SHA512 febade61cc1734db891234484893128519dffc198f80883fc4838534684f91db2a21641252615820ae9bedffce52451535ea2717a40958b80ea82590850b90ac DIST opencc-1.1.7.tar.gz 3311712 BLAKE2B 158a4ea5707ade583d326b0e4441640cbaae2ccb1c89c4ccfaeb8b8dd6f1d427a7f5fcaae7ac0bd6fca3208c65fe24577f6b6ba9c7fec1a499936ef83887d181 SHA512 26e4b12238f853b0fa91f9f0d9af7985bf04a0763185cc3b50b69ba99a2d80091b8c3160176d0d4cd348fbf1a680bfd80dc740dc60c938a256dc2dac8ef49f15 -EBUILD opencc-1.1.4.ebuild 1585 BLAKE2B d8d1d3f49e839eafa6ace24e9d65742922ccf61ee7659c2e8a9acfdf8de1fb1d4f10ad1d72784538421243db765684ed9d9b3193250f4b82f4c41d128fc2e62b SHA512 70b260dd9da2569fb0bd40a863082bf9cb55e87e6520ff5309c5fc0cb39b7acaec34297a0eeee23fdb1cd9c59856c1beb498dc338224c4421cbd75aa51fb91d8 -EBUILD opencc-1.1.7-r1.ebuild 2917 BLAKE2B 214accb22626092128a2205bb98aa8c9e9c624092cf80f0b02057d600395eba6fadf4fb2776c337067bcf119f62587a87e9c77f0df40ca3a1760eec556403420 SHA512 cd42250a2ca901da3244461be66a41101e27a6c93566a58e5efba539717a1505d234ebf51e1cca2118bc7be72fcf171751236a1b0557b34d608d654379e18e32 +DIST opencc-1.1.9.tar.gz 3422511 BLAKE2B e83fda092fafa3dc4a108c4d1d6c35cfe2e75609cd5bc2eea9c9b59ef636c876e8993b0b45291f35dd86e69f3182ddbcd775fa8d347e5e5ac89576b09a5cb901 SHA512 713cf00931d7616994eb455eef3bc893096b5cd6d42b346aa1130591752d9612891ea3ed035bd7bd4ec7df1c90425e86375f5b3337fac11663c656c79a8f33e9 +EBUILD opencc-1.1.7-r2.ebuild 2858 BLAKE2B 1415ef25b489f55b82acdde761221f482d9d002e313b8bd4b938b69a326100616ba61e724a2dfba282126832e0da5790682afa50e1b164fdc5dda18a06fe5741 SHA512 e0ea800ec231013f3514a8b4b76f86a4e89c0f83cc61f19ab148d7494e33e0a6116e0cf000da26d59660771741cc60536e543abcf8fc1216442036d0a10d2db8 EBUILD opencc-1.1.7.ebuild 1438 BLAKE2B a3f6cb414d2b0f04153b82b8145bd2a72a84dea533fcdc3a1197924ef17463ba1047a813be28e69d44976fc8f76f46a2c59c2ba3d20a2c57a9606e3b25acd963 SHA512 59c1e27e94a19ba0a89a9f759ad8ef3e9dd7ce0c33fc6c220f8b688fa9e4d0dce92101c6a5679891e8f5a4258dd505ce5acf574f39344c91d0b2a567b4b477c6 +EBUILD opencc-1.1.9.ebuild 3017 BLAKE2B eb0de6eb5231f42ddfedd5a41879a0786c855de519765ddff92039e90228310caabe45e58c3d98d89fd192f8805e99fd3518cc400cef46bf0c5ac5cae07a0b5d SHA512 66da43c14a1e3dbc92d1d55f384e2a46b75ba1501080b3359594d91c03d15a69f9a2d7a352b2714fa27b792c8673e78519767af0198f3a61a2a57e25992142d2 MISC metadata.xml 476 BLAKE2B 4f02f06aa7aca103fff825675453e36a256f130b086992df550aab3dee3c155a48667d00df171053b417b20873a6ed8f1142c9efcfdd8e0994fafa7c1aec5e0b SHA512 c1a73732105a87bf3bca8af82d027b5a0dc0b379e7f8b1fbd301ee6a1f0e986ce8db9542394fc87f885a8736d82836b574a956601bb244172912f58455f39bfb diff --git a/app-i18n/opencc/files/opencc-1.1.9-python.patch b/app-i18n/opencc/files/opencc-1.1.9-python.patch new file mode 100644 index 000000000000..442771256649 --- /dev/null +++ b/app-i18n/opencc/files/opencc-1.1.9-python.patch @@ -0,0 +1,162 @@ +From 8f3a5b4b201f091713cb4e2b1b5883a4b12d10b2 Mon Sep 17 00:00:00 2001 +From: Frost Ming <mianghong@gmail.com> +Date: Thu, 18 Jul 2024 05:32:08 +0800 +Subject: [PATCH] fix: release sdist to PyPI (#797) + +* fix: release sdist to PyPI + +* fix: add newline at file end + +* fix: ignore more files + +Signed-off-by: Frost Ming <me@frostming.com> + +* fix: change the install root of cmake + +Signed-off-by: Frost Ming <me@frostming.com> + +* fix: make it work for editable build as well + +Signed-off-by: Frost Ming <me@frostming.com> + +* fix release script + +Signed-off-by: Frost Ming <me@frostming.com> + +* fix: include files in sdist + +Signed-off-by: Frost Ming <me@frostming.com> + +--------- + +Signed-off-by: Frost Ming <me@frostming.com> +Co-authored-by: Carbo Kuo <BYVoid@users.noreply.github.com> +--- + .github/workflows/python.yml | 10 ++++---- + .gitignore | 1 + + MANIFEST.in | 9 +++++++ + Makefile | 6 ++--- + pyproject.toml | 3 +++ + python/opencc/.gitignore | 1 + + python/opencc/clib/__init__.py | 1 - + release-pypi-linux.sh | 8 +++---- + release-pypi-macos.sh | 6 ++--- + release-pypi-windows.cmd | 6 ++--- + setup.py | 43 +++++++++------------------------- + 11 files changed, 43 insertions(+), 51 deletions(-) + create mode 100644 MANIFEST.in + create mode 100644 pyproject.toml + +diff --git a/setup.py b/setup.py +index a7ce160d..a4bc500f 100644 +--- a/setup.py ++++ b/setup.py +@@ -9,21 +9,12 @@ + import wheel.bdist_wheel + + _this_dir = os.path.dirname(os.path.abspath(__file__)) +-_clib_dir = os.path.join(_this_dir, 'python', 'opencc', 'clib') + _build_dir = os.path.join(_this_dir, 'build', 'python') + + _cmake_file = os.path.join(_this_dir, 'CMakeLists.txt') + _author_file = os.path.join(_this_dir, 'AUTHORS') + _readme_file = os.path.join(_this_dir, 'README.md') + +-try: +- sys.path.insert(0, os.path.join(_this_dir, 'python')) +- +- import opencc # noqa +- _libopencc_built = True +-except ImportError: +- _libopencc_built = False +- + + def get_version_info(): + version_info = ['1', '0', '0'] +@@ -70,20 +61,13 @@ def get_long_description(): + return f.read().decode('utf-8') + + +-def build_libopencc(): +- if _libopencc_built: +- return # Skip building binary file ++def build_libopencc(output_path): + print('building libopencc into %s' % _build_dir) + + is_windows = sys.platform == 'win32' + + # Make build directories +- if is_windows: +- subprocess.call('md {}'.format(_build_dir), shell=True) +- subprocess.call('md {}'.format(_clib_dir), shell=True) +- else: +- subprocess.call('mkdir -p {}'.format(_build_dir), shell=True) +- subprocess.call('mkdir -p {}'.format(_clib_dir), shell=True) ++ os.makedirs(_build_dir, exist_ok=True) + + # Configure + cmake_args = [ +@@ -93,14 +77,14 @@ def build_libopencc(): + '-DENABLE_BENCHMARK:BOOL=OFF', + '-DBUILD_PYTHON:BOOL=ON', + '-DCMAKE_BUILD_TYPE=Release', +- '-DCMAKE_INSTALL_PREFIX={}'.format(_clib_dir), +- '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={}'.format(_clib_dir), ++ '-DCMAKE_INSTALL_PREFIX={}'.format(output_path), ++ '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={}'.format(output_path), + '-DPYTHON_EXECUTABLE={}'.format(sys.executable), + ] + + if is_windows: + cmake_args += \ +- ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE={}'.format(_clib_dir)] ++ ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE={}'.format(output_path)] + if sys.maxsize > 2**32: + cmake_args += ['-A', 'x64'] + +@@ -117,11 +101,6 @@ def build_libopencc(): + errno = subprocess.call(cmd) + assert errno == 0, 'Build failed' + +- # Empty __init__.py file has to be created +- # to make opencc.clib a module +- with open('{}/__init__.py'.format(_clib_dir), 'w'): +- pass +- + + class OpenCCExtension(setuptools.Extension, object): + def __init__(self, name, sourcedir=''): +@@ -131,8 +110,12 @@ def __init__(self, name, sourcedir=''): + + class BuildExtCommand(setuptools.command.build_ext.build_ext, object): + def build_extension(self, ext): ++ if self.inplace: ++ output_path = os.path.join(_this_dir, 'python', 'opencc', 'clib') ++ else: ++ output_path = os.path.abspath(os.path.join(self.build_lib, 'opencc', 'clib')) + if isinstance(ext, OpenCCExtension): +- build_libopencc() ++ build_libopencc(output_path) + else: + super(BuildExtCommand, self).build_extension(ext) + +@@ -157,7 +140,7 @@ def _determine_platform_tag(): + return 'macosx-11.0-{}'.format(machine) + else: + raise NotImplementedError +- ++ + if os.name == 'posix': + _, _, _, _, machine = os.uname() + return 'manylinux2014-{}'.format(machine) +@@ -190,10 +173,6 @@ def initialize_options(self): + + packages=packages, + package_dir={'opencc': 'python/opencc'}, +- package_data={str('opencc'): [ +- 'clib/opencc_clib*', +- 'clib/share/opencc/*', +- ]}, + ext_modules=[OpenCCExtension('opencc.clib.opencc_clib', 'python')], + cmdclass={ + 'build_ext': BuildExtCommand, diff --git a/app-i18n/opencc/opencc-1.1.4.ebuild b/app-i18n/opencc/opencc-1.1.4.ebuild deleted file mode 100644 index 9c8761e44dc2..000000000000 --- a/app-i18n/opencc/opencc-1.1.4.ebuild +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 2010-2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="8" -PYTHON_COMPAT=( python3_{9..11} ) - -inherit cmake python-any-r1 - -if [[ "${PV}" == "9999" ]]; then - inherit git-r3 - - EGIT_REPO_URI="https://github.com/BYVoid/OpenCC" -fi - -DESCRIPTION="Library for conversion between Traditional and Simplified Chinese characters" -HOMEPAGE="https://github.com/BYVoid/OpenCC" -if [[ "${PV}" == "9999" ]]; then - SRC_URI="" -else - SRC_URI="https://github.com/BYVoid/OpenCC/archive/ver.${PV}.tar.gz -> ${P}.tar.gz" -fi - -LICENSE="Apache-2.0" -SLOT="0/1.1" -KEYWORDS="amd64 arm64 ~hppa ~loong ppc ppc64 ~riscv sparc x86" -IUSE="doc test" -RESTRICT="!test? ( test )" - -BDEPEND="${PYTHON_DEPS} - doc? ( app-text/doxygen )" -DEPEND="dev-cpp/tclap - dev-libs/darts - dev-libs/marisa:0= - dev-libs/rapidjson - test? ( - dev-cpp/gtest - !hppa? ( !sparc? ( dev-cpp/benchmark ) ) - )" -RDEPEND="dev-libs/marisa:0=" - -if [[ "${PV}" != "9999" ]]; then - S="${WORKDIR}/OpenCC-ver.${PV}" -fi - -DOCS=(AUTHORS NEWS.md README.md) - -src_prepare() { - rm -r deps || die - - cmake_src_prepare - - sed -e "s:\${DIR_SHARE_OPENCC}/doc:share/doc/${PF}:" -i doc/CMakeLists.txt || die -} - -src_configure() { - local mycmakeargs=( - -DBUILD_DOCUMENTATION=$(usex doc ON OFF) - -DENABLE_BENCHMARK=$(if use test && has_version -d dev-cpp/benchmark; then echo ON; else echo OFF; fi) - -DENABLE_GTEST=$(usex test ON OFF) - -DUSE_SYSTEM_DARTS=ON - -DUSE_SYSTEM_GOOGLE_BENCHMARK=ON - -DUSE_SYSTEM_GTEST=ON - -DUSE_SYSTEM_MARISA=ON - -DUSE_SYSTEM_RAPIDJSON=ON - -DUSE_SYSTEM_TCLAP=ON - ) - - cmake_src_configure -} diff --git a/app-i18n/opencc/opencc-1.1.7-r1.ebuild b/app-i18n/opencc/opencc-1.1.7-r2.ebuild index eabc31068ad5..7c8387fd815f 100644 --- a/app-i18n/opencc/opencc-1.1.7-r1.ebuild +++ b/app-i18n/opencc/opencc-1.1.7-r2.ebuild @@ -51,10 +51,6 @@ PATCHES=( "${FILESDIR}/${P}-fix-missing-cstdint-for-gcc-15.patch" ) -pkg_setup() { - use python && python-single-r1_pkg_setup -} - src_prepare() { rm -r deps || die diff --git a/app-i18n/opencc/opencc-1.1.9.ebuild b/app-i18n/opencc/opencc-1.1.9.ebuild new file mode 100644 index 000000000000..df2e04117895 --- /dev/null +++ b/app-i18n/opencc/opencc-1.1.9.ebuild @@ -0,0 +1,122 @@ +# Copyright 2010-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..13} ) +DISTUTILS_EXT=1 +DISTUTILS_OPTIONAL=1 +DISTUTILS_SINGLE_IMPL=1 +DISTUTILS_USE_PEP517=setuptools + +inherit cmake distutils-r1 + +DESCRIPTION="Library for conversion between Traditional and Simplified Chinese characters" +HOMEPAGE="https://github.com/BYVoid/OpenCC" +SRC_URI="https://github.com/BYVoid/OpenCC/archive/ver.${PV}.tar.gz -> ${P}.tar.gz" +S="${WORKDIR}/OpenCC-ver.${PV}" + +LICENSE="Apache-2.0" +SLOT="0/1.1" +KEYWORDS="~amd64 ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86" +IUSE="doc python test" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" +RESTRICT="!test? ( test )" + +RDEPEND="dev-libs/marisa + python? ( ${PYTHON_DEPS} ) +" +DEPEND="${RDEPEND} + dev-cpp/tclap + dev-libs/darts + dev-libs/rapidjson +" +BDEPEND="${PYTHON_DEPS} + doc? ( app-text/doxygen ) + python? ( + ${DISTUTILS_DEPS} + app-admin/chrpath + $(python_gen_cond_dep 'dev-python/pybind11[${PYTHON_USEDEP}]') + test? ( $(python_gen_cond_dep 'dev-python/pytest[${PYTHON_USEDEP}]') ) + ) + test? ( + dev-cpp/gtest + !hppa? ( !sparc? ( dev-cpp/benchmark ) ) + ) +" + +DOCS=( AUTHORS NEWS.md README.md ) + +src_prepare() { + # as of opencc 1.1.8 there is no clean way to disable duplicated building of the clib again. + # plus, the installation is broken as well. + # let's revert the offending commit for now. + eapply -R "${FILESDIR}/${P}-python.patch" + + rm -r deps || die + + sed -e "s:\${DIR_SHARE_OPENCC}/doc:share/doc/${PF}:" -i doc/CMakeLists.txt || die + + cmake_src_prepare + use python && distutils-r1_src_prepare +} + +src_configure() { + local mycmakeargs=( + -DBUILD_DOCUMENTATION=$(usex doc) + -DBUILD_PYTHON=$(usex python) + -DENABLE_BENCHMARK=$(if use test && has_version -d dev-cpp/benchmark; then echo ON; else echo OFF; fi) + -DENABLE_GTEST=$(usex test) + -DUSE_SYSTEM_DARTS=ON + -DUSE_SYSTEM_GOOGLE_BENCHMARK=ON + -DUSE_SYSTEM_GTEST=ON + -DUSE_SYSTEM_MARISA=ON + -DUSE_SYSTEM_PYBIND11=ON + -DUSE_SYSTEM_RAPIDJSON=ON + -DUSE_SYSTEM_TCLAP=ON + ) + + cmake_src_configure + use python && distutils-r1_src_configure +} + +src_compile() { + cmake_src_compile + if use python; then + cp "${BUILD_DIR}"/opencc_clib.*.so python/opencc/clib/ + distutils-r1_src_compile + fi +} + +python_test() { + epytest +} + +src_test() { + cmake_src_test + if use python; then + cd "${BUILD_DIR}_${EPYTHON}/install/usr/lib/${EPYTHON}/site-packages/opencc/clib" || die + mkdir -p share/opencc || die + cp "${S}/data/config"/*.json share/opencc/ || die + pushd "${S}" || die + + distutils-r1_src_test + + popd || die + rm -r share/ || die + fi +} + +src_install() { + cmake_src_install + if use python; then + distutils-r1_src_install + + # Hack to make opencc's python binding to use system opencc's configs + dodir "/usr/lib/${EPYTHON}/site-packages/opencc/clib/share" + dosym -r /usr/share/opencc "/usr/lib/${EPYTHON}/site-packages/opencc/clib/share/opencc" + + # Remove insecure RPATH + chrpath --delete "${ED}/usr/lib/${EPYTHON}/site-packages/opencc/clib"/*.so || die + fi +} |