17
0
Files
python-FontTools/python-FontTools.spec
Takashi Iwai fb6b0bc32a Accepting request 807893 from home:alarrosa:branches:devel:languages:python
- Update to 4.10.2:
  * Note: The v4.x version series only supports Python 3.6 or greater.
  * see NEWS.rst for the full changelog
- Use _multibuild to run the tests in a different flavor and make it
  possible to BuildRequire ufoLib2 (which requires FontTools to build)
  without creating a dependency cycle.
- Add curves.json from upstream as a separate source as it's
  missing from the zip file.

OBS-URL: https://build.opensuse.org/request/show/807893
OBS-URL: https://build.opensuse.org/package/show/M17N/python-FontTools?expand=0&rev=11
2020-05-25 07:12:32 +00:00

125 lines
3.7 KiB
RPMSpec

#
# spec file for package python-FontTools
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%else
%define psuffix %{nil}
%endif
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-FontTools%{psuffix}
Version: 4.10.2
Release: 0
Summary: Suite of Tools and Libraries for Manipulating Fonts
License: MIT AND OFL-1.1
Group: Development/Languages/Python
URL: http://github.com/fonttools/fonttools
Source: https://files.pythonhosted.org/packages/source/f/fonttools/fonttools-%{version}.zip
Source1: https://raw.githubusercontent.com/fonttools/fonttools/master/Tests/cu2qu/data/curves.json
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: unzip
Requires: python-brotlipy >= 0.7.0
Requires: python-fs >= 2.4.11
Requires: python-lxml >= 4.0
Requires: python-reportlab
Requires: python-scipy >= 1.4.1
Requires: python-sympy
Requires: python-unicodedata2 >= 13.0.0
%if "%{flavor}" == "test"
# SECTION test requirements
BuildRequires: %{python_module brotlipy >= 0.7.0}
BuildRequires: %{python_module fs >= 2.4.11}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module scipy >= 1.4.1}
BuildRequires: %{python_module sympy}
BuildRequires: %{python_module ufoLib2 >= 0.6.2}
BuildRequires: %{python_module zopfli >= 0.1.6}
%endif
BuildRequires: zip
# /SECTION
%ifpython3
Obsoletes: fonttools < %{version}
Provides: fonttools = %{version}
Provides: python-fonttools = %{version}
%endif
BuildArch: noarch
%python_subpackages
%description
FontTools is a suite of tools and libraries for manipulating fonts
written in Python.
It currently reads and writes TrueType font files, reads PostScript
Type 1 fonts, and more. It contains two command line programs to
convert TrueType fonts to an XML based format (called TTX) and back.
%prep
%setup -q -n fonttools-%{version}
# Remove shebang
sed -i -e '/^#!\//, 1d' Lib/fontTools/mtiLib/__init__.py
cp %{S:1} Tests/cu2qu/data/curves.json
%build
%python_build
%install
%if "%{flavor}" != "test"
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
# remove undocumented and non working script
rm %{buildroot}%{_bindir}/fonttools
%endif
%if "%{flavor}" == "test"
%check
ufodir='Tests/ufoLib/testdata/TestFont1 (UFO3).ufo'
if [ ! -e "${ufodir}z" ]; then
# they forgot to ship Tests/ufoLib/testdata/TestFont1 (UFO3).ufoz
pushd $(dirname "$ufodir")
name=$(basename "$ufodir")
zip -r "${name}z" "$name"
popd
else
echo "this can be removed (including zip buildrequires)"
exit 1
fi
export LANG=en_US.UTF-8
export PYTHONDONTWRITEBYTECODE=1
%pytest
%else
%files %{python_files}
%license LICENSE LICENSE.external
%doc README.rst NEWS.rst
%{python_sitelib}/*
%python3_only %{_bindir}/pyftmerge
%python3_only %{_bindir}/pyftsubset
%python3_only %{_bindir}/ttx
%python3_only %{_mandir}/man1/ttx.1%{?ext_man}
%endif
%changelog