1 |
commit: 213c494e788511c8e47b6449302324b1fbdb028b |
2 |
Author: David Seifert <soap <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Sep 4 18:45:49 2016 +0000 |
4 |
Commit: David Seifert <soap <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Sep 4 18:57:55 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=213c494e |
7 |
|
8 |
sci-calculators/units: Add py3.5 support |
9 |
|
10 |
* EAPI=6 |
11 |
* Unify py2/3 codebases, making installation easier |
12 |
* Fix python handling in broken build system |
13 |
|
14 |
Package-Manager: portage-2.3.0 |
15 |
|
16 |
.../units/files/units-2.13-fix-python.patch | 144 +++++++++++++++++++++ |
17 |
sci-calculators/units/units-2.13-r1.ebuild | 44 +++++++ |
18 |
2 files changed, 188 insertions(+) |
19 |
|
20 |
diff --git a/sci-calculators/units/files/units-2.13-fix-python.patch b/sci-calculators/units/files/units-2.13-fix-python.patch |
21 |
new file mode 100644 |
22 |
index 00000000..5278890 |
23 |
--- /dev/null |
24 |
+++ b/sci-calculators/units/files/units-2.13-fix-python.patch |
25 |
@@ -0,0 +1,144 @@ |
26 |
+* Unify the two python codebases, making the installation less cumbersome |
27 |
+* Remove the broken python handling in Autoconf and the Makefile |
28 |
+ |
29 |
+--- a/units_cur3 |
30 |
++++ b/units_cur3 |
31 |
+@@ -16,6 +16,12 @@ |
32 |
+ # Added test for non-unicode strings to prevent a runtime warning |
33 |
+ # |
34 |
+ |
35 |
++# py2.7 shims |
36 |
++from __future__ import unicode_literals |
37 |
++from builtins import map, str, range |
38 |
++from future.standard_library import install_aliases |
39 |
++install_aliases() |
40 |
++ |
41 |
+ import sys |
42 |
+ import urllib.request, urllib.parse, urllib.error |
43 |
+ import os |
44 |
+--- a/configure.ac |
45 |
++++ b/configure.ac |
46 |
+@@ -155,18 +155,6 @@ |
47 |
+ fi |
48 |
+ fi |
49 |
+ |
50 |
+- |
51 |
+-AC_PATH_PROG(PYTHON, python, no) |
52 |
+- |
53 |
+-if test $PYTHON = no; then |
54 |
+- HAVE_PYTHON=no |
55 |
+- echo ' Units will work without python but the currency update' |
56 |
+- echo ' script, units_cur, will not be installed' |
57 |
+- PYTHON='' |
58 |
+-else |
59 |
+- HAVE_PYTHON=yes |
60 |
+-fi |
61 |
+- |
62 |
+ dnl Check for path search option |
63 |
+ AC_ARG_ENABLE([relocation], |
64 |
+ AC_HELP_STRING([--enable-relocation], |
65 |
+--- a/Makefile.in |
66 |
++++ b/Makefile.in |
67 |
+@@ -79,14 +79,14 @@ |
68 |
+ DISTFILES = README ChangeLog units.info units.txt getopt1.c units.dvi \ |
69 |
+ Makefile.in units.c getopt.c getopt.h definitions.units units.texinfo \ |
70 |
+ configure.ac configure strfunc.c COPYING install-sh \ |
71 |
+- units.man NEWS texi2man INSTALL units.pdf units_cur2 units_cur3 \ |
72 |
++ units.man NEWS texi2man INSTALL units.pdf \ |
73 |
+ parse.tab.c parse.y units.h locale_map.txt fdl-1.3.texi currency.units \ |
74 |
+ unitsfile.ico unitsprog.ico units.rc icon_ms.png \ |
75 |
+ Makefile.OS2 makeobjs.cmd README.OS2 \ |
76 |
+ UnitsMKS.texinfo UnitsMKS.pdf setvcvars.sh \ |
77 |
+ UnitsWin.texinfo UnitsWin.pdf winmkdirs.bat Makefile.Win |
78 |
+ |
79 |
+-all: units@EXEEXT@ units.1 units.info units_cur_inst |
80 |
++all: units@EXEEXT@ units.1 units.info |
81 |
+ |
82 |
+ units.@OBJEXT@: units.c units.h |
83 |
+ |
84 |
+@@ -98,47 +98,11 @@ |
85 |
+ units@EXEEXT@: $(OBJECTS) @MKS_RES@ |
86 |
+ $(CC) $(CFLAGS) $(LDFLAGS) -o units@EXEEXT@ $(OBJECTS) @MKS_RES@ $(LIBS) |
87 |
+ |
88 |
+-units_cur: units_cur2 units_cur3 |
89 |
+- @if test $(HAVE_PYTHON) = no; then \ |
90 |
+- $(MAKE) units_cur_dummy; \ |
91 |
+- else \ |
92 |
+- version=`$(PYTHON) --version 2>&1`; \ |
93 |
+- if echo $$version | grep 'Python 2' >/dev/null; then \ |
94 |
+- cp $(srcdir)/units_cur2 units_cur; \ |
95 |
+- echo Creating units_cur for Python 2; \ |
96 |
+- elif echo $$version | grep 'Python 3'>/dev/null; then \ |
97 |
+- cp $(srcdir)/units_cur3 units_cur; \ |
98 |
+- echo Creating units_cur for Python 3; \ |
99 |
+- else \ |
100 |
+- echo Unrecognized Python version: $$version; \ |
101 |
+- echo Unable to create correct units_cur; \ |
102 |
+- exit 1; \ |
103 |
+- fi; \ |
104 |
+- fi |
105 |
+- |
106 |
+-units_cur_dummy: |
107 |
+- echo '\#!/bin/sh' > units_cur |
108 |
+- echo 'echo Units_cur requires python, which was not found when units was configured' >> units_cur |
109 |
+- chmod +x units_cur |
110 |
+- |
111 |
+-units_cur3: units_cur2 |
112 |
+- -mkdir python3_tempdir |
113 |
+- 2to3 --no-diffs -n -o python3_tempdir -w units_cur2 |
114 |
+- mv python3_tempdir/units_cur2 units_cur3 |
115 |
+- rm -rf python3_tempdir |
116 |
+- |
117 |
+-units_cur_inst: units_cur |
118 |
+- sed -e "s@outfile = 'currency.units'@outfile='@UDAT@××××××××.units'@"\ |
119 |
+- -e "s@/usr/bin/python@$(PYTHON)@" \ |
120 |
+- units_cur > units_cur_inst |
121 |
+- |
122 |
+-install-support: definitions.units currency.units units_cur_inst |
123 |
++install-support: definitions.units currency.units |
124 |
+ $(MKDIR_P) $(DESTDIR)@UDAT@ $(DESTDIR)$(bindir) |
125 |
+ $(INSTALL_DATA) $(srcdir)/definitions.units $(DESTDIR)@UDAT@×××××××××××.units |
126 |
+ $(INSTALL_DATA) $(srcdir)/currency.units $(DESTDIR)@UDAT@××××××××.units |
127 |
+ $(INSTALL_DATA) $(srcdir)/locale_map.txt $(DESTDIR)@UDAT@locale_map.txt |
128 |
+- if test $(HAVE_PYTHON) = yes; then \ |
129 |
+- $(INSTALL_PROGRAM) units_cur_inst $(DESTDIR)$(bindir)/`echo units_cur|sed '$(transform)'`;fi |
130 |
+ if test $(HAVE_MKS) = yes; then make install-mks; fi |
131 |
+ |
132 |
+ |
133 |
+@@ -209,14 +173,13 @@ |
134 |
+ $(DESTDIR)@UDAT@locale_map.txt \ |
135 |
+ $(DESTDIR)@UDAT@×××××××××.ico \ |
136 |
+ $(DESTDIR)@UDAT@×××××××××.ico \ |
137 |
+- $(DESTDIR)$(bindir)/`echo units_cur|sed '$(transform)'` |
138 |
+ -rmdir $(DESTDIR)@UDAT@ |
139 |
+ @if test -f $(DESTDIR)$(infodir)/dir; then \ |
140 |
+ echo You may need to remove units.info from $(DESTDIR)$(infodir)/dir; \ |
141 |
+ else true; fi |
142 |
+ |
143 |
+ clean mostlyclean: texclean |
144 |
+- -rm -f *.obj *.res units.exe units.dvi units.1 distname .chk units_cur_inst units_cur |
145 |
++ -rm -f *.obj *.res units.exe units.dvi units.1 distname .chk |
146 |
+ -rm -rf wwwold wwwnew |
147 |
+ |
148 |
+ distclean: clean |
149 |
+@@ -232,9 +195,8 @@ |
150 |
+ -rm -f units.log UnitsMKS.log UnitsWin.log \ |
151 |
+ *.aux *.cp *.fn *.ky *.op *.pg *.toc *.tp *.vr |
152 |
+ |
153 |
+-currency.units: units_cur |
154 |
++currency.units: |
155 |
+ @echo "Trying to update currency.units (will use existing file if this fails)" |
156 |
+- -./units_cur |
157 |
+ |
158 |
+ sig: |
159 |
+ echo units-`sed -n -e '/\#.*VERSION/s/.*"\(.*\)"/\1/gp' \ |
160 |
+@@ -247,8 +209,7 @@ |
161 |
+ -rm -f `cat distname`.directive distname |
162 |
+ |
163 |
+ |
164 |
+-dist: $(DISTFILES) units_cur |
165 |
+- @./units_cur |
166 |
++dist: $(DISTFILES) |
167 |
+ @echo Updated currencies, running check: |
168 |
+ ./units -f definitions.units -c |
169 |
+ @echo '' |
170 |
|
171 |
diff --git a/sci-calculators/units/units-2.13-r1.ebuild b/sci-calculators/units/units-2.13-r1.ebuild |
172 |
new file mode 100644 |
173 |
index 00000000..33bb1a7 |
174 |
--- /dev/null |
175 |
+++ b/sci-calculators/units/units-2.13-r1.ebuild |
176 |
@@ -0,0 +1,44 @@ |
177 |
+# Copyright 1999-2016 Gentoo Foundation |
178 |
+# Distributed under the terms of the GNU General Public License v2 |
179 |
+# $Id$ |
180 |
+ |
181 |
+EAPI=6 |
182 |
+ |
183 |
+PYTHON_COMPAT=( python{2_7,3_4,3_5} ) |
184 |
+PYTHON_REQ_USE="xml" |
185 |
+ |
186 |
+inherit autotools python-r1 |
187 |
+ |
188 |
+DESCRIPTION="Unit conversion program" |
189 |
+HOMEPAGE="https://www.gnu.org/software/units/units.html" |
190 |
+SRC_URI="mirror://gnu/${PN}/${P}.tar.gz" |
191 |
+ |
192 |
+LICENSE="FDL-1.3 GPL-3" |
193 |
+SLOT="0" |
194 |
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" |
195 |
+IUSE="+units_cur" |
196 |
+REQUIRED_USE="units_cur? ( ${PYTHON_REQUIRED_USE} )" |
197 |
+ |
198 |
+RDEPEND=" |
199 |
+ sys-libs/readline:0= |
200 |
+ units_cur? ( |
201 |
+ ${PYTHON_DEPS} |
202 |
+ dev-python/unidecode[${PYTHON_USEDEP}] |
203 |
+ dev-python/future[${PYTHON_USEDEP}] |
204 |
+ )" |
205 |
+DEPEND="${RDEPEND}" |
206 |
+ |
207 |
+PATCHES=( "${FILESDIR}/${P}-fix-python.patch" ) |
208 |
+ |
209 |
+src_prepare() { |
210 |
+ default |
211 |
+ sed -e "/^outfile/s|'.*'|'${EPREFIX}/usr/share/units/currency.units'|g" \ |
212 |
+ -i units_cur3 || die |
213 |
+ |
214 |
+ eautoreconf |
215 |
+} |
216 |
+ |
217 |
+src_install() { |
218 |
+ default |
219 |
+ use units_cur && python_foreach_impl python_newscript units_cur{3,} |
220 |
+} |