forked from WeblateOrg/weblate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
weblate.spec
109 lines (92 loc) · 3.56 KB
/
weblate.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
Name: weblate
Version: 1.5
Release: 1
License: GPL-3+
Summary: Web-based translation tool
Group: Productivity/Networking/Web/Frontends
Source: %{name}-%{version}.tar.bz2
BuildRequires: bitstream-vera
BuildRequires: graphviz
BuildRequires: python-Sphinx
BuildRequires: graphviz-gd
Url: http://weblate.org/
Requires: apache2-mod_wsgi
Requires: cron
Requires: python-django >= 1.3
Requires: python-django-registration >= 0.8
Requires: translate-toolkit
Requires: python-GitPython >= 0.3
Requires: python-whoosh
Requires: python-cairo
Requires: python-South
Requires: python-gtk
%py_requires
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
Vendor: Michal Čihař <[email protected]>
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%define WLDIR /usr/share/weblate
%define WLDATADIR /var/lib/weblate
%define WLETCDIR /%{_sysconfdir}/weblate
%description
Weblate is a free web-based translation tool with tight Git integration. It
features simple and clean user interface, propagation of translations across
subprojects, quality checks and automatic linking to source files.
List of features includes:
* Easy web based translation
* Propagation of translations across sub-projects (for different branches)
* Tight git integration - every change is represented by Git commit
* Usage of Django's admin interface
* Upload and automatic merging of po files
* Links to source files for context
* Allows to use machine translation services
* Message quality checks
* Tunable access control
* Wide range of supported translation formats (Getext, Qt, Java, Windows, Symbian and more)
%prep
%setup -q
%build
make -C docs html
cp weblate/settings_example.py weblate/settings.py
sed -i 's@^WEB_ROOT = .*@WEB_ROOT = "%{WLDIR}/weblate"@g' weblate/settings.py
sed -i 's@^WHOOSH_INDEX = .*@WHOOSH_INDEX = "%{WLDATADIR}/whoosh-index"@g' weblate/settings.py
sed -i 's@^GIT_ROOT = .*@GIT_ROOT = "%{WLDATADIR}/repos"@g' weblate/settings.py
sed -i "s@'ENGINE': 'django.db.backends.sqlite3'@'ENGINE': 'django.db.backends.mysql'@" weblate/settings.py
sed -i "s@'NAME': 'weblate.db'@'NAME': 'weblate'@" weblate/settings.py
sed -i 's@/usr/lib/python.*/site-packages@%{python_sitelib}@g' examples/apache.conf
%install
install -d %{buildroot}/%{WLDIR}
install -d %{buildroot}/%{WLETCDIR}
# Copy all files
cp -a . %{buildroot}/%{WLDIR}
# We ship this separately
rm -rf %{buildroot}/%{WLDIR}/docs
rm -f %{buildroot}/%{WLDIR}/README.md \
%{buildroot}/%{WLDIR}/ChangeLog \
%{buildroot}/%{WLDIR}/COPYING \
%{buildroot}/%{WLDIR}/INSTALL
# Byte compile python files
%py_compile %{buildroot}/%{WLDIR}
# Move configuration to etc
mv %{buildroot}/%{WLDIR}/weblate/settings.py %{buildroot}/%{WLETCDIR}/
ln -s %{WLETCDIR}/settings.py %{buildroot}/%{WLDIR}/weblate/settings.py
# Apache config
install -d %{buildroot}/%{_sysconfdir}/apache2/vhosts.d/
install -m 644 examples/apache.conf %{buildroot}/%{_sysconfdir}/apache2/vhosts.d/weblate.conf
# Whoosh index dir
install -d %{buildroot}/%{WLDATADIR}
install -d %{buildroot}/%{WLDATADIR}/whoosh-index
install -d %{buildroot}/%{WLDATADIR}/repos
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
%doc docs/_build/html
%doc README.md
%config(noreplace) /%{_sysconfdir}/weblate
%config(noreplace) /%{_sysconfdir}/apache2
%{WLDIR}
%attr(0755,wwwrun,www) %{WLDATADIR}
%attr(0755,wwwrun,www) %{WLDATADIR}/whoosh-index
%attr(0755,wwwrun,www) %{WLDATADIR}/repos
%changelog