]>
Commit | Line | Data |
---|---|---|
07be5a78 JR |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without python2 # CPython 2.x module | |
4 | %bcond_without python3 # CPython 3.x module | |
5 | ||
6 | Summary: A pure Python library for multiprecision floating-point arithmetic | |
7 | Name: python-mpmath | |
8 | Version: 0.18 | |
15e239f0 | 9 | Release: 2 |
07be5a78 JR |
10 | License: BSD |
11 | Group: Libraries/Python | |
12 | URL: http://code.google.com/p/mpmath/ | |
13 | Source0: http://mpmath.googlecode.com/files/mpmath-%{version}.tar.gz | |
14 | # Source0-md5: e2e7a7932969f52f25b7e19d8f0438bd | |
15 | Source1: http://mpmath.googlecode.com/files/mpmath-docsrc-%{version}.tar.gz | |
16 | # Source1-md5: 65286d76dff4f02f41b31f1c3d1810dd | |
17 | %if %{with python2} | |
18 | BuildRequires: python-devel | |
19 | BuildRequires: python-Sphinx | |
20 | %endif | |
21 | %if %{with python3} | |
22 | BuildRequires: python3-devel | |
23 | BuildRequires: python-Sphinx | |
24 | %endif | |
25 | BuildRequires: texlive-latex | |
26 | BuildArch: noarch | |
27 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
28 | ||
29 | %description | |
30 | Mpmath is a pure-Python library for multiprecision floating-point | |
31 | arithmetic. It provides an extensive set of transcendental functions, | |
32 | unlimited exponent sizes, complex numbers, interval arithmetic, | |
33 | numerical integration and differentiation, root-finding, linear | |
34 | algebra, and much more. Almost any calculation can be performed just | |
35 | as well at 10-digit or 1000-digit precision, and in many cases mpmath | |
36 | implements asymptotically fast algorithms that scale well for | |
37 | extremely high precision work. If available, mpmath will (optionally) | |
38 | use gmpy to speed up high precision operations. | |
39 | ||
40 | If you require plotting capabilities in mpmath, install | |
41 | python-matplotlib. | |
42 | ||
43 | %package -n python3-mpmath | |
44 | Summary: A pure Python library for multiprecision floating-point arithmetic | |
45 | Group: Libraries/Python | |
46 | ||
47 | %description -n python3-mpmath | |
48 | Mpmath is a pure-Python library for multiprecision floating-point | |
49 | arithmetic. It provides an extensive set of transcendental functions, | |
50 | unlimited exponent sizes, complex numbers, interval arithmetic, | |
51 | numerical integration and differentiation, root-finding, linear | |
52 | algebra, and much more. Almost any calculation can be performed just | |
53 | as well at 10-digit or 1000-digit precision, and in many cases mpmath | |
54 | implements asymptotically fast algorithms that scale well for | |
55 | extremely high precision work. If available, mpmath will (optionally) | |
56 | use gmpy to speed up high precision operations. | |
57 | ||
58 | If you require plotting capabilities in mpmath, install | |
59 | python3-matplotlib. | |
60 | ||
61 | %package doc | |
62 | Summary: HTML documentation for %{name} | |
63 | Group: Documentation | |
64 | Requires: %{name} = %{version}-%{release} | |
65 | ||
66 | %description doc | |
67 | This package contains the HTML documentation for %{name}. | |
68 | ||
69 | %prep | |
70 | %setup -q -n mpmath-%{version} -a 1 | |
71 | # Convert line encodings | |
72 | for doc in LICENSE CHANGES PKG-INFO README.rst mpmath/tests/runtests.py; do | |
73 | %{__sed} "s|\r||g" $doc > $doc.new && \ | |
74 | touch -r $doc $doc.new && \ | |
75 | %{__mv} $doc.new $doc | |
76 | done | |
77 | find doc -name *.txt -exec sed -i "s|\r||g" {} \; | |
78 | ||
79 | shebangs="mpmath/matrices/eigen.py mpmath/matrices/eigen_symmetric.py mpmath/tests/runtests.py mpmath/tests/test_eigen.py mpmath/tests/test_eigen_symmetric.py mpmath/tests/test_levin.py" | |
80 | # Get rid of unnecessary shebangs | |
81 | for lib in $shebangs; do | |
82 | %{__sed} '/^#!.*/d; 1q' $lib > $lib.new && \ | |
83 | touch -r $lib $lib.new && \ | |
84 | %{__mv} $lib.new $lib | |
85 | done | |
86 | ||
87 | %build | |
88 | %if %{with python2} | |
89 | python setup.py build | |
90 | %{__python} setup.py build --build-base build-2 | |
91 | %endif | |
92 | ||
93 | %if %{with python3} | |
94 | %{__python3} setup.py build --build-base build-3 | |
95 | %endif | |
96 | ||
97 | cd doc | |
98 | python build.py | |
99 | ||
100 | %install | |
101 | rm -rf $RPM_BUILD_ROOT | |
102 | ||
103 | %if %{with python2} | |
104 | %{__python} setup.py \ | |
105 | build --build-base build-2 \ | |
106 | install --skip-build \ | |
107 | --optimize=2 \ | |
108 | --root=$RPM_BUILD_ROOT | |
109 | ||
110 | %py_postclean | |
111 | %endif | |
112 | ||
113 | %if %{with python3} | |
114 | %{__python3} setup.py \ | |
115 | build --build-base build-3 \ | |
116 | install --skip-build \ | |
117 | --optimize=2 \ | |
118 | --root=$RPM_BUILD_ROOT | |
119 | %endif | |
120 | ||
121 | %clean | |
122 | rm -rf $RPM_BUILD_ROOT | |
123 | ||
124 | %if %{with python2} | |
125 | %files | |
126 | %defattr(644,root,root,755) | |
127 | %doc CHANGES LICENSE PKG-INFO README.rst | |
128 | %{py_sitescriptdir}/mpmath/ | |
129 | %{py_sitescriptdir}/mpmath-%{version}-*.egg-info | |
130 | %endif | |
131 | ||
132 | %if %{with python3} | |
133 | %files -n python3-mpmath | |
134 | %defattr(644,root,root,755) | |
135 | %doc CHANGES LICENSE PKG-INFO README.rst | |
136 | %{py3_sitescriptdir}/mpmath/ | |
137 | %{py3_sitescriptdir}/mpmath-%{version}-*.egg-info | |
138 | %endif | |
139 | ||
140 | %files doc | |
141 | %defattr(644,root,root,755) | |
142 | %doc doc/build/* |