File translate-toolkit.spec of Package translate-toolkit
#
# spec file for package translate-toolkit
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#
Name: translate-toolkit
Version: 1.9.0
Release: 0
License: GPL-2.0+
Summary: Tools to assist with translation and software localization
Url: http://translate.sourceforge.net/wiki/toolkit/index
Group: Development/Tools/Other
Source0: %{name}-%{version}.tar.bz2
BuildRequires: fdupes
BuildRequires: python-devel
BuildRequires: python-Levenshtein
Requires: gettext-runtime
# The following are for the full experience of translate-toolkit
Requires: python-Levenshtein
Requires: python-aeidon
%if 0%{?suse_version} <= 1210
Requires: python-enchant
%else
Requires: python-pyenchant
%endif
Requires: python-iniparse
Requires: python-lxml
Requires: python-simplejson
Requires: vobject
Provides: python-translate-toolkit = %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} >= 1140
BuildArch: noarch
%endif
# The following are needed for man page generation
BuildRequires: python-xml
BuildRequires: python-lxml
BuildRequires: python-lxml-doc
BuildRequires: python-simplejson
BuildRequires: vobject
%py_requires
%description
A set of tools for managing translation and software localization via Gettext PO or XLIFF format files.
Including:
* Convertors: convert from various formats to PO or XLIFF
* Formats:
* Core localization formats - XLIFF and Gettext PO
* Other localization formats - TMX, TBX, Qt Linguist (.ts), Java .properties, Wordfast TM, OmegaT glossary
* Compiled formats: Gettext MO, Qt .qm
* Other formats - OpenDocument Format (ODF), text, HTML, CSV, INI, wiki (MediaWiki, DokuWiki), iCal
* Specialised - OpenOffice.org GSI/SDF, PHP, Mozilla (.dtd, .properties, etc), Symbian, Innosetup, tikiwiki, subtitles
* Tools: count, search, debug, segment and pretranslate localization files. Extract terminology. Pseudo-localize
* Checkers: validate translations with over 45 checks
%package devel
Summary: Tools to assist with translation and software localization
Group: Development/Libraries/Python
Requires: %{name} = %{version}
%if 0%{?suse_version} >= 1140
BuildArch: noarch
%endif
%description devel
The %{name}-devel package contains Translate Toolkit API documentation for developers wishing to build new tools for the
toolkit or to use the libraries in other localization tools.
%prep
%setup -q
%build
python setup.py build
%install
python setup.py install \
--prefix=%{_prefix} \
--root=%{buildroot} \
# create manpages
mkdir -p %{buildroot}/%{_mandir}/man1
for program in %{buildroot}/%{_bindir}/*; do
case $(basename $program) in
pocompendium|poen|pomigrate2|popuretext|poreencode|posplit|pocount|poglossary|lookupclient.py|tmserver|build_tmdb)
;;
*)
LC_ALL=C PYTHONPATH=. $program --manpage \
> %{buildroot}/%{_mandir}/man1/$(basename $program).1 \
|| rm -f %{buildroot}/%{_mandir}/man1/$(basename $program).1
;;
esac
done
# remove documentation files from site-packages
rm %{buildroot}/%{python_sitelib}/translate/{COPYING,ChangeLog,LICENSE,README}
rm %{buildroot}/%{python_sitelib}/translate/{convert,filters,tools}/TODO
rm %{buildroot}/%{python_sitelib}/translate/misc/README
# fix for bnc#750652 - remove Apache-2.0 file - difflib is the fallback solution
rm %{buildroot}/%{python_sitelib}/translate/misc/diff_match_patch.py
#Fix for shebang errors:
for lib in %{buildroot}%{python_sitelib}/translate/{*.py,*/*.py,*/*/*.py}; do
sed '/\/usr\/bin\/env/d' $lib > $lib.new &&
touch -r $lib $lib.new &&
mv $lib.new $lib
done
# create symlinks for man pages
%fdupes -s %{buildroot}/%{_mandir}
# create hardlinks for the rest
%fdupes %{buildroot}
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
%exclude %{python_sitelib}/translate/doc/api
%doc translate/ChangeLog translate/COPYING translate/README
%doc translate/doc/user/toolkit-[a-z]*
%exclude %{python_sitelib}/translate/doc/api
%{_bindir}/*
%{_mandir}/man1/*
%{python_sitelib}/translate
%{python_sitelib}/translate_toolkit-%{version}-py%{py_ver}.egg-info
%files devel
%defattr(-,root,root)
%doc %{python_sitelib}/translate/doc/api
%changelog