Accepting request 543870 from home:pluskalm:branches:LibreOffice:Factory

- Add patches to fix tests when using python3:
  * graphite2-python3_tests.patch
  * graphite2-python3_tests_cornercases.patch
- Refresh all other patches
- Use fancy name for downloaded tarball
- Run spec-cleaner

OBS-URL: https://build.opensuse.org/request/show/543870
OBS-URL: https://build.opensuse.org/package/show/LibreOffice:Factory/graphite2?expand=0&rev=50
This commit is contained in:
Tomáš Chvátal 2017-11-20 12:44:57 +00:00 committed by Git OBS Bridge
parent 1f76ff7f90
commit 2c934879d6
8 changed files with 191 additions and 20 deletions

View File

@ -1,7 +1,7 @@
Index: graphite2-1.3.0/tests/bittwiddling/bits.cpp
Index: graphite-1.3.10/tests/bittwiddling/bits.cpp
===================================================================
--- graphite2-1.3.0.orig/tests/bittwiddling/bits.cpp
+++ graphite2-1.3.0/tests/bittwiddling/bits.cpp
--- graphite-1.3.10.orig/tests/bittwiddling/bits.cpp
+++ graphite-1.3.10/tests/bittwiddling/bits.cpp
@@ -81,6 +81,7 @@ namespace
{
if (!std::numeric_limits<T>::is_signed) o.put('u');

View File

@ -1,7 +1,8 @@
diff -urN graphite2-1.2.0.orig/src/CMakeLists.txt graphite2-1.2.0/src/CMakeLists.txt
--- graphite2-1.2.0.orig/src/CMakeLists.txt 2013-01-29 15:47:32.465841769 +0530
+++ graphite2-1.2.0/src/CMakeLists.txt 2013-01-29 15:48:24.056843352 +0530
@@ -136,4 +136,4 @@
Index: graphite-1.3.10/src/CMakeLists.txt
===================================================================
--- graphite-1.3.10.orig/src/CMakeLists.txt
+++ graphite-1.3.10/src/CMakeLists.txt
@@ -155,4 +155,4 @@ endif (${CMAKE_SYSTEM_NAME} STREQUAL "Wi
install(TARGETS graphite2 EXPORT graphite2 LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} PUBLIC_HEADER DESTINATION include/graphite2 RUNTIME DESTINATION bin)

View File

@ -0,0 +1,98 @@
From d96d572627cde920af9044e0b6386e2edf56e767 Mon Sep 17 00:00:00 2001
From: Tim Eves <tim_eves@sil.org>
Date: Wed, 2 Aug 2017 12:18:11 +0700
Subject: [PATCH] Make python test programs python2 & 3 compatible
---
tests/fnttxtrender | 11 ++++++++---
tests/graphite.py | 13 +++++++++----
2 files changed, 17 insertions(+), 7 deletions(-)
Index: graphite-1.3.10/tests/fnttxtrender
===================================================================
--- graphite-1.3.10.orig/tests/fnttxtrender
+++ graphite-1.3.10/tests/fnttxtrender
@@ -1,5 +1,11 @@
#!/usr/bin/python
+from __future__ import print_function, unicode_literals
+try:
+ import itertools.imap as map
+except ImportError:
+ pass
+
import codecs
from optparse import OptionParser
from difflib import SequenceMatcher
@@ -202,7 +208,7 @@ rounding = 0.1 ** opts.dp
# if --graphite_library is used.
import graphite as gr
-outfile = codecs.getwriter("utf_8")(open(opts.output, mode="wt") if opts.output else sys.stdout)
+outfile = codecs.getwriter("utf_8")(open(opts.output, mode="wb") if opts.output else sys.stdout)
if opts.compare :
with open(opts.compare) as f :
@@ -237,7 +243,7 @@ for label, words in reader :
wcount = 0
for s in words :
wcount += 1
- gls = [map(lambda x: name(tt, x, rounding), font.glyphs(s, includewidth = True))]
+ gls = [list(map(lambda x: name(tt, x, rounding), font.glyphs(s, includewidth = True)))]
if gls[-1][-1][0] is None : gls[-1] = ('_adv_', gls[-1][-1][1], gls[-1][-1][2])
l = makelabel(label, count, wcount)
if cjson is not None and cmpgls(gls[0], cjson[l][0], opts.epsilon) :
@@ -251,4 +257,3 @@ for label, words in reader :
if log is not None : log.logend()
outfile.close()
sys.exit(errors)
-
Index: graphite-1.3.10/tests/graphite.py
===================================================================
--- graphite-1.3.10.orig/tests/graphite.py
+++ graphite-1.3.10/tests/graphite.py
@@ -17,7 +17,11 @@
# suite 500, Boston, MA 02110-1335, USA or visit their web page on the
# internet at http://www.fsf.org/licenses/lgpl.html.
-
+from __future__ import print_function, unicode_literals, division, absolute_import
+try:
+ unicode
+except NameError:
+ unicode = str
from ctypes import *
import ctypes.util
import sys, os, platform
@@ -181,6 +185,7 @@ class FeatureRef(object) :
class Face(object) :
def __init__(self, data, options = 0, fn=None, segcache=0) :
+ data = data.encode('utf8')
if fn :
if segcache :
self.face = gr2.gr_make_face_with_seg_cache(data, fn, segcache, options)
@@ -202,12 +207,12 @@ class Face(object) :
return gr2.fr_face_n_glyphs(self.face)
def get_featureval(self, lang) :
- if isinstance(lang, basestring) :
+ if isinstance(lang, bytes) :
lang = gr_str_to_tag(lang)
return FeatureVal(gr2.gr_face_featureval_for_lang(self.face, lang))
def get_featureref(self, featid) :
- if isinstance(featid, basestring) :
+ if isinstance(featid, bytes) :
featid = gr_str_to_tag(featid)
return FeatureRef(gr2.gr_face_find_fref(self.face, featid))
@@ -320,7 +325,7 @@ class Segment(object) :
def __init__(self, font, face, scriptid, string, rtl, length = None, feats = None) :
if not length :
length = len(string)
- if isinstance(scriptid, basestring) :
+ if isinstance(scriptid, bytes) :
scriptid = gr2.gr_str_to_tag(scriptid)
self.seg = gr2.gr_make_seg(font.font if font is not None else 0, face.face, scriptid, (feats.fval if feats else 0), 1, string.encode('utf_8'), length, rtl)

View File

@ -0,0 +1,58 @@
From 3ab48d1e2ba14c3369f7b8649a49fec601382bc4 Mon Sep 17 00:00:00 2001
From: Tim Eves <tim_eves@sil.org>
Date: Wed, 18 Oct 2017 16:09:52 +0700
Subject: [PATCH] Fix a few python2 & 3 corner cases
---
tests/fnttxtrender | 2 +-
tests/jsoncmp | 11 +++--------
2 files changed, 4 insertions(+), 9 deletions(-)
Index: graphite-1.3.10/tests/fnttxtrender
===================================================================
--- graphite-1.3.10.orig/tests/fnttxtrender
+++ graphite-1.3.10/tests/fnttxtrender
@@ -248,7 +248,7 @@ for label, words in reader :
l = makelabel(label, count, wcount)
if cjson is not None and cmpgls(gls[0], cjson[l][0], opts.epsilon) :
errors += 1
- print l + " Failed"
+ print(l + " Failed")
if opts.quiet : continue
if log is None :
log = JsonLog(outfile, fpaths, opts, args)
Index: graphite-1.3.10/tests/jsoncmp
===================================================================
--- graphite-1.3.10.orig/tests/jsoncmp
+++ graphite-1.3.10/tests/jsoncmp
@@ -1,11 +1,10 @@
#!/usr/bin/python
from __future__ import print_function, unicode_literals
-from itertools import imap
import sys, json, operator, re
def walktree(tree, path="", parent=None) :
- if isinstance(tree, (list,dict)):
- ixs = sorted(tree.iteritems(), key=operator.itemgetter(0)) if isinstance(tree, dict) else enumerate(tree)
+ if isinstance(tree, (list,dict)):
+ ixs = sorted(tree.items(), key=operator.itemgetter(0)) if isinstance(tree, dict) else enumerate(tree)
for k,v in ixs :
for y in walktree(v, "{0}/{1!s}".format(path, k), tree) :
yield y
@@ -67,7 +66,7 @@ def _compare(t1, t2):
def compare(j1, j2) :
trimtelemetry(j1)
trimtelemetry(j2)
- return all(imap(_compare, walktree(j1), walktree(j2)))
+ return all(map(_compare, walktree(j1), walktree(j2)))
try:
r1 = canonids(readjson(sys.argv[1]))
@@ -85,7 +84,3 @@ res = compare(r1, r2)
if res :
sys.exit(0)
sys.exit(1)
-
-
-
-

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Mon Nov 20 12:16:37 UTC 2017 - mpluskal@suse.com
- Add patches to fix tests when using python3:
* graphite2-python3_tests.patch
* graphite2-python3_tests_cornercases.patch
- Refresh all other patches
- Use fancy name for downloaded tarball
- Run spec-cleaner
-------------------------------------------------------------------
Wed Jun 21 19:13:30 UTC 2017 - tchvatal@suse.com

View File

@ -21,14 +21,16 @@ Name: graphite2
Version: 1.3.10
Release: 0
Summary: Font rendering capabilities for complex non-Roman writing systems
License: LGPL-2.1+ or MPL-2.0+
License: LGPL-2.1+ OR MPL-2.0+
Group: Productivity/Publishing/Word
Url: https://github.com/silnrsi/graphite
Source0: https://github.com/silnrsi/graphite/archive/%{version}.tar.gz
Url: http://graphite.sil.org/
Source0: https://github.com/silnrsi/graphite/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: baselibs.conf
Patch0: graphite2-1.2.0-cmakepath.patch
Patch1: graphite-nonvoid-return.patch
Patch2: link-gcc-shared.diff
Patch3: graphite2-python3_tests.patch
Patch4: graphite2-python3_tests_cornercases.patch
BuildRequires: asciidoc
BuildRequires: cmake
BuildRequires: fontconfig-devel
@ -38,8 +40,7 @@ BuildRequires: freetype2-devel
BuildRequires: gcc-c++
BuildRequires: glib2-devel
BuildRequires: pkgconfig
BuildRequires: python-base
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python3
%description
Graphite2 is a project within SIL's Non-Roman Script Initiative and Language
@ -81,9 +82,14 @@ This package contains the %{name} development files.
%setup -q -n graphite-%{version}
%patch0 -p1
%patch1 -p1
%patch2
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
# Make sure to use python3 everywhere
find tests -type f -exec sed -i "s|python|python3|g" {} +
find . -name *.cmake -exec sed -i "s|python|python3|g" {} +
%cmake \
-DGRAPHITE2_COMPARE_RENDERER=OFF \
-DGRAPHITE2_NTRACING=ON \
@ -102,20 +108,16 @@ find %{buildroot} -type f -name "*.la" -delete -print
%ctest
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%files
%defattr(-,root,root)
%doc LICENSE COPYING
%{_bindir}/gr2fonttest
%files -n %{libname}
%defattr(-,root,root)
%{_libdir}/*.so.3*
%files devel
%defattr(-,root,root)
%{_libdir}/*.so
%{_libdir}/pkgconfig/%{name}*.pc
%{_includedir}/%{name}*

View File

@ -1,6 +1,8 @@
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -121,7 +121,7 @@
Index: graphite-1.3.10/src/CMakeLists.txt
===================================================================
--- graphite-1.3.10.orig/src/CMakeLists.txt
+++ graphite-1.3.10/src/CMakeLists.txt
@@ -127,7 +127,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linu
if (GRAPHITE2_ASAN)
target_link_libraries(graphite2 c gcc_s)
else (GRAPHITE2_ASAN)