summaryrefslogtreecommitdiff
path: root/dev-python/gmpy
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/gmpy')
-rw-r--r--dev-python/gmpy/Manifest1
-rw-r--r--dev-python/gmpy/files/gmpy-2.0.8-fix-mpir-types.patch17
-rw-r--r--dev-python/gmpy/files/gmpy-2.0.8-test-exit-status.patch41
-rw-r--r--dev-python/gmpy/gmpy-2.0.8-r1.ebuild72
-rw-r--r--dev-python/gmpy/metadata.xml22
5 files changed, 153 insertions, 0 deletions
diff --git a/dev-python/gmpy/Manifest b/dev-python/gmpy/Manifest
new file mode 100644
index 000000000000..16c5bf2552d3
--- /dev/null
+++ b/dev-python/gmpy/Manifest
@@ -0,0 +1 @@
+DIST gmpy2-2.0.8.zip 280551 BLAKE2B b73c48b739ae6972231672ad28598c09e00db6348cd281d190c6dfcf49b0e977563baabe84825658d78bf1e2ac4927ad1882787b6d4efd19f28a4f7fd6a061b4 SHA512 090f449641f378c73eb166831b1d956c6cee3da83e42fde8741f18aa0fa687e37927fc3b045d4b35e3a3b75570e6b1074150d8bc29d16119ab5c717bcfcf9fb4
diff --git a/dev-python/gmpy/files/gmpy-2.0.8-fix-mpir-types.patch b/dev-python/gmpy/files/gmpy-2.0.8-fix-mpir-types.patch
new file mode 100644
index 000000000000..d21e5a55510d
--- /dev/null
+++ b/dev-python/gmpy/files/gmpy-2.0.8-fix-mpir-types.patch
@@ -0,0 +1,17 @@
+diff -ur gmpy2-2.0.8.orig/src/gmpy.h gmpy2-2.0.8/src/gmpy.h
+--- gmpy2-2.0.8.orig/src/gmpy.h 2018-04-03 22:44:35.494621951 -0700
++++ gmpy2-2.0.8/src/gmpy.h 2018-04-03 22:45:33.580835296 -0700
+@@ -129,8 +129,13 @@
+ #ifndef BITS_PER_UI
+ /* Assume we are NOT using MPIR > 2.5. */
+ #define BITS_PER_UI BITS_PER_ULONG
++#if defined(__mips__) && (_MIPS_SIM == _ABIN32)
++typedef unsigned long long mpir_ui;
++typedef long long mpir_si;
++#else
+ typedef unsigned long mpir_ui;
+ typedef long mpir_si;
++#endif
+ #define mpz_fits_si_p mpz_fits_slong_p
+ #define mpz_fits_ui_p mpz_fits_ulong_p
+ #endif
diff --git a/dev-python/gmpy/files/gmpy-2.0.8-test-exit-status.patch b/dev-python/gmpy/files/gmpy-2.0.8-test-exit-status.patch
new file mode 100644
index 000000000000..ab4128ff55ca
--- /dev/null
+++ b/dev-python/gmpy/files/gmpy-2.0.8-test-exit-status.patch
@@ -0,0 +1,41 @@
+diff -dupr a/test2/gmpy_test.py b/test2/gmpy_test.py
+--- a/test2/gmpy_test.py 2019-11-22 09:21:42.313037873 +0100
++++ b/test2/gmpy_test.py 2013-08-20 22:17:52.000000000 +0200
+@@ -34,11 +34,15 @@ writeln(" Caching Values: (Number)
+ writeln(" Caching Values: (Size, limbs) {0}".format(_g.get_cache()[1]))
+
+ pf, pt = 0, 0
++ret = 0
+ for x in test_modules:
+ testit = x._test()
+ failures, tests = testit
+ if tests == 0: continue
++ if failures > 0: ret = 1
+ writeln("%s %3d tests, %d failures" % (x.__name__, tests-pt, failures-pf))
+ pf, pt = failures, tests
+
+ doctest.master.summarize(1)
++
++sys.exit(ret)
+diff -dupr a/test3/gmpy_test.py b/test3/gmpy_test.py
+--- a/test3/gmpy_test.py 2019-11-22 09:21:30.421908749 +0100
++++ b/test3/gmpy_test.py 2013-08-20 22:17:52.000000000 +0200
+@@ -28,10 +28,12 @@ print(" Caching Values: (Number) {
+ print(" Caching Values: (Size, limbs) {0}".format(_g.get_cache()[1]))
+
+ pf, pt = 0, 0
++ret = 0
+ for x in test_modules:
+ testit = x._test()
+ failures, tests = testit
+ if tests == 0: continue
++ if failures > 0: ret = 1
+ print("%s %3d tests, %d failures" % (x.__name__, tests-pt, failures-pf))
+ pf, pt = failures, tests
+
+@@ -41,3 +43,5 @@ if sys.version_info < (3,1,1):
+ print("There is a known bug with Fraction == mpq for versions of Python")
+ print("less than 3.1.1. Please upgrade if you rely on comparisons between")
+ print("Python's Fraction and gmpy2's mpq.")
++
++sys.exit(ret)
diff --git a/dev-python/gmpy/gmpy-2.0.8-r1.ebuild b/dev-python/gmpy/gmpy-2.0.8-r1.ebuild
new file mode 100644
index 000000000000..489f7e730962
--- /dev/null
+++ b/dev-python/gmpy/gmpy-2.0.8-r1.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DISTUTILS_USE_SETUPTOOLS=no
+PYTHON_COMPAT=( python2_7 python3_{6,7,8,9} )
+
+inherit distutils-r1
+
+MY_PN="${PN}2"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="Python bindings for GMP, MPC, MPFR and MPIR libraries"
+HOMEPAGE="https://github.com/aleaxit/gmpy"
+SRC_URI="mirror://pypi/${PN:0:1}/${MY_PN}/${MY_P}.zip"
+S="${WORKDIR}"/${MY_P}
+
+LICENSE="LGPL-3+"
+SLOT="2"
+KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="mpir"
+
+RDEPEND="
+ >=dev-libs/mpc-1.0.2:=
+ >=dev-libs/mpfr-3.1.2:=
+ !mpir? ( dev-libs/gmp:0= )
+ mpir? ( sci-libs/mpir:= )"
+DEPEND="${RDEPEND}"
+BDEPEND="
+ app-arch/unzip"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-fix-mpir-types.patch
+ "${FILESDIR}"/gmpy-2.0.8-test-exit-status.patch
+)
+
+distutils_enable_sphinx docs
+
+python_prepare_all() {
+ # rm non std test file
+ rm test*/gmpy_test_thr.py || die
+ # testing for contents of __dir__ is really silly, and fails
+ sed -i -e '/__dir__/,+1d' test3/*.py || die
+ # fix sphinx-1.8+ compat
+ # https://github.com/aleaxit/gmpy/commit/c35c1f3319fcf95e894a59a6d523851bad4abf66
+ sed -i -e 's:pngmath:imgmath:' docs/conf.py || die
+
+ distutils-r1_python_prepare_all
+}
+
+python_configure_all() {
+ mydistutilsargs=(
+ $(usex mpir --mpir --gmp)
+ )
+}
+
+python_compile() {
+ python_is_python3 || local -x CFLAGS="${CFLAGS} -fno-strict-aliasing"
+ distutils-r1_python_compile
+}
+
+python_test() {
+ cd test || die
+ "${EPYTHON}" runtests.py || die "tests failed under ${EPYTHON}"
+ if python_is_python3; then
+ cd ../test3 || die
+ else
+ cd ../test2 || die
+ fi
+ "${EPYTHON}" gmpy_test.py || die "tests failed under ${EPYTHON}"
+}
diff --git a/dev-python/gmpy/metadata.xml b/dev-python/gmpy/metadata.xml
new file mode 100644
index 000000000000..6960ada83b3d
--- /dev/null
+++ b/dev-python/gmpy/metadata.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ <name>Python</name>
+ </maintainer>
+ <longdescription lang="en">
+ gmpy2 is a C-coded Python extension module that supports
+ multiple-precision arithmetic. gmpy2 supports the GMP multi-precision
+ library, the MPFR (correctly rounded real floating-point arithmetic) and MPC
+ (correctly rounded complex floating-point arithmetic) libraries.
+</longdescription>
+ <upstream>
+ <remote-id type="pypi">gmpy2</remote-id>
+ <remote-id type="github">aleaxit/gmpy</remote-id>
+ </upstream>
+ <use>
+ <flag name="mpir">Use <pkg>sci-libs/mpir</pkg> as gmp implementation</flag>
+ </use>
+ <origin>gentoo-staging</origin>
+</pkgmetadata>