2 # - move %{_datadir}/pootle/mo/* to system localedir as pootle.mo
3 %define fullname Pootle
4 Summary: Localization and translation management web application
9 Group: Development/Tools
10 Source0: https://github.com/translate/pootle/releases/download/%{version}/Pootle-%{version}.tar.bz2
11 # Source0-md5: b1bac7ae18dc3632c471c63e72852949
13 Patch0: settings.patch
16 URL: http://pootle.translatehouse.org/
17 BuildRequires: python-devel
18 BuildRequires: python-modules
19 BuildRequires: rpm-pythonprov
20 BuildRequires: rpmbuild(macros) >= 1.228
21 BuildRequires: sed >= 4.0
22 BuildRequires: translate-toolkit >= 1.4.1
23 Requires: apache-mod_alias
24 Requires: apache-mod_authz_host
25 Requires: apache-mod_mime
26 Requires: apache-mod_wsgi
29 Requires: python-Levenshtein
30 Requires: python-django >= 1.0
31 Requires: python-django-south
32 Requires: python-djblets
34 Requires: translate-toolkit >= 1.8.0
37 Suggests: python(sqlite)
38 Suggests: python-memcached
39 Suggests: python-xapian
40 Conflicts: python-xapian < 1.0.13
42 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
44 %define _webapps /etc/webapps
45 %define _webapp %{name}
46 %define _sysconfdir %{_webapps}/%{_webapp}
49 Pootle is web application for managing distributed or crowdsourced
52 It's features include::
53 - Translation of Gettext PO and XLIFF files.
54 - Submitting to remote version control systems (VCS).
55 - Managing groups of translators
56 - Online webbased or offline translation
60 %setup -q -n %{fullname}-%{version}
65 #%{__sed} -i -e '1s,#!.*env python,#!%{__python},' wsgi.py
68 %{__python} setup.py build
71 rm -rf $RPM_BUILD_ROOT
72 install -d $RPM_BUILD_ROOT{%{_sbindir},%{_datadir}/pootle,%{_sharedstatedir}/pootle/po/.tmp,%{_sysconfdir}}
74 %{__python} setup.py install \
77 --root=$RPM_BUILD_ROOT
79 # install_dirs.py was modified _after_ install completed, so compile again
81 # TODO. compile only install_dirs.py
82 %py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}
83 %py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}
87 install -d $RPM_BUILD_ROOT%{_mandir}/man1
88 for program in $RPM_BUILD_ROOT%{_bindir}/*; do
89 case $(basename $program) in
90 PootleServer|import_pootle_prefs)
93 LC_ALL=C PYTHONPATH=. $program --manpage \
94 > $RPM_BUILD_ROOT%{_mandir}/man1/$(basename $program).1 \
95 || rm -f $RPM_BUILD_ROOT%{_mandir}/man1/$(basename $program).1
101 # application language
102 for a in $RPM_BUILD_ROOT%{_datadir}/pootle/mo/[a-z]*; do
104 p=${a#$RPM_BUILD_ROOT} l=${a##*/}
105 echo "%lang($l) $p" >> %{name}.lang
108 # such recursive magic is because we need to have different permissions for
109 # directories and files and we want to language tag both of them
112 # skip bad globs (happens when we recurse)
113 [ -e "$obj" ] || continue
115 path=${obj#$RPM_BUILD_ROOT} lang=${MO_LANG:-${obj##*/}}
118 attr='%dir %attr(770,root,http)'
120 attr='%attr(660,root,http) %config(noreplace) %verify(not md5 mtime size)'
124 echo "$attr $path" >> %{name}.lang
127 echo "%lang($lang) $attr $path" >> %{name}.lang
131 MO_LANG=$lang scan_mo $obj/*
136 scan_mo $RPM_BUILD_ROOT%{_sharedstatedir}/pootle/po/{pootle,terminology,tutorial}/* >> %{name}.lang
138 # don't clobber user $PATH
139 #mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/PootleServer
140 #install -p manage.py $RPM_BUILD_ROOT%{_sbindir}/pootle-manage
141 #install -p wsgi.py $RPM_BUILD_ROOT%{_datadir}/pootle
143 install -d $RPM_BUILD_ROOT%{_sysconfdir}
144 cp -a %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
147 rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}
150 #rm -r $RPM_BUILD_ROOT%{py_sitescriptdir}/djblets
153 rm -rf $RPM_BUILD_ROOT
155 %triggerin -- apache < 2.2.0, apache-base
156 %webapp_register httpd %{_webapp}
158 %triggerun -- apache < 2.2.0, apache-base
159 %webapp_unregister httpd %{_webapp}
161 %files -f %{name}.lang
162 %defattr(644,root,root,755)
163 %doc CREDITS README.rst
164 %dir %attr(750,root,http) %{_sysconfdir}
165 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
166 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/localsettings.py
167 %attr(755,root,root) %{_bindir}/import_pootle_prefs
168 %attr(755,root,root) %{_bindir}/updatetm
169 %attr(755,root,root) %{_sbindir}/PootleServer
170 %{_mandir}/man1/updatetm.1*
172 %dir %{_datadir}/pootle
173 %{_datadir}/pootle/mo/README
174 %attr(755,root,root) %{_datadir}/pootle/wsgi.py
175 %{_datadir}/pootle/html
176 %{_datadir}/pootle/templates
177 %dir %{_datadir}/pootle/mo
179 %{py_sitescriptdir}/contact_form_i18n
180 %{py_sitescriptdir}/pootle
181 %{py_sitescriptdir}/pootle_app
182 %{py_sitescriptdir}/pootle_autonotices
183 %{py_sitescriptdir}/pootle_language
184 %{py_sitescriptdir}/pootle_misc
185 %{py_sitescriptdir}/pootle_notifications
186 %{py_sitescriptdir}/pootle_profile
187 %{py_sitescriptdir}/pootle_project
188 %{py_sitescriptdir}/pootle_statistics
189 %{py_sitescriptdir}/pootle_store
190 %{py_sitescriptdir}/pootle_terminology
191 %{py_sitescriptdir}/pootle_translationproject
192 %{py_sitescriptdir}/profiles
193 %{py_sitescriptdir}/registration
194 %if "%{py_ver}" > "2.4"
195 %{py_sitescriptdir}/Pootle-*.egg-info
198 %dir %{_sharedstatedir}/pootle
199 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/dbs
200 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po
201 # setup a tempdir inside the PODIRECTORY heirarchy, this way we have
202 # reasonable guarantee that temp files will be created on the same
203 # filesystem as translation files (required for save operations).
204 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/.tmp
206 # base translations from pootle itself
207 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/pootle
208 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/terminology
209 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/tutorial