d7490e8
%global commit 19796b19b3f1eff5513e2299cf8dfe918f93eb56
d7490e8
%global shortcommit %(c=%{commit}; echo ${c:0:7})
d7490e8
d7490e8
Name:           openstv
d7490e8
Version:        1.7
83f8948
Release:        8%{?dist}
d7490e8
Summary:        Single transferable vote and instant runoff voting software
d7490e8
d7490e8
Group:          Applications/Productivity
d7490e8
License:        GPLv2+
d7490e8
URL:            https://github.com/OpenTechStrategies/%{name}
d7490e8
Source0:        https://github.com/OpenTechStrategies/%{name}/archive/%{commit}/%{name}-%{commit}.tar.gz
d7490e8
Source1:        openstv
d7490e8
Source2:        openstv-run-election
d7490e8
Source3:        openstv.1
d7490e8
Source4:        openstv-run-election.1
d7490e8
Source5:        openstv.desktop
d7490e8
Source6:        openstv.appdata.xml
d7490e8
# Install icons, image and HTML documentation used by the application
d7490e8
Patch0:	        openstv-1.7-setup-package-data.patch
041bf0a
# https://bugzilla.redhat.com/show_bug.cgi?id=1185599
041bf0a
Patch1:	        openstv-1.7-wxpython3.0.patch
d7490e8
d7490e8
BuildArch:      noarch
d7490e8
BuildRequires:  desktop-file-utils
d7490e8
BuildRequires:  icoutils
d7490e8
BuildRequires:  python2-devel
ac05d93
BuildRequires:  /usr/bin/appstream-util
d7490e8
Requires:       hicolor-icon-theme
d7490e8
Requires:       wxPython
d7490e8
d7490e8
%description
d7490e8
OpenSTV is an open-source software for implementing the single transferable
d7490e8
vote and other voting methods such as instant runoff voting, Condorcet voting,
d7490e8
and approval voting. OpenSTV is the only open-source software that implements
d7490e8
the single transferable vote exactly as used by governments, including Scotland
d7490e8
and the City of Cambridge, Massachusetts. These methods have been extensively
d7490e8
verified against other software and/or actual election results.
d7490e8
d7490e8
Organizations can use OpenSTV to implement their own elections. First, the
d7490e8
organization must adopt a voting method. Second, the organization must conduct
d7490e8
the vote, and this will most likely be done with paper ballots. Third, the
d7490e8
ballots must be entered into the OpenSTV program. Finally, you can use OpenSTV
d7490e8
to count the votes and determine the winners of the election.
d7490e8
d7490e8
%prep
d7490e8
%setup -q -n %{name}-%{commit}
d7490e8
sed -i 's:#!/usr/bin/env python:# Run openstv instead:' openstv/OpenSTV.py
d7490e8
sed -i 's:#!/usr/bin/env python:# Run openstv-run-election instead:' openstv/runElection.py
d7490e8
%patch0 -p1
041bf0a
%patch1 -p1
d7490e8
icotool --extract --index=7 openstv/Icons/pie.ico
d7490e8
mv pie_7_48x48x32.png %{name}.png
d7490e8
d7490e8
d7490e8
%build
d7490e8
%{__python2} setup.py build
d7490e8
d7490e8
d7490e8
%install
d7490e8
%{__python2} setup.py install --root=%{buildroot}
d7490e8
install -Dpm 0755 %{SOURCE1} %{buildroot}%{_bindir}/openstv
d7490e8
install -pm 0755 %{SOURCE2} %{buildroot}%{_bindir}/openstv-run-election
d7490e8
install -Dpm 0644 %{SOURCE3} %{buildroot}%{_mandir}/man1/openstv.1
d7490e8
install -pm 0644 %{SOURCE4} %{buildroot}%{_mandir}/man1/openstv-run-election.1
d7490e8
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE5}
d7490e8
install -Dpm 0644 %{name}.png %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
d7490e8
install -Dpm 0644 %{SOURCE6} %{buildroot}%{_datadir}/appdata/%{name}.appdata.xml
d7490e8
ln -sf %{python2_sitelib}/%{name}/License.html License.html
d7490e8
ac05d93
ac05d93
%check
ac05d93
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/%{name}.appdata.xml
ac05d93
ac05d93
d7490e8
%post
d7490e8
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
d7490e8
d7490e8
%postun
d7490e8
if [ $1 -eq 0 ] ; then
d7490e8
    touch --no-create %{_datadir}/icons/hicolor &>/dev/null
d7490e8
    gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
d7490e8
fi
d7490e8
d7490e8
%posttrans
d7490e8
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
d7490e8
d7490e8
d7490e8
%files
d7490e8
%doc CHANGELOG.txt License.html README.md
d7490e8
%{_bindir}/%{name}*
d7490e8
%{python2_sitelib}/%{name}/
d7490e8
%{python2_sitelib}/OpenSTV-%{version}-*.egg-info
4411906
%{_mandir}/man1/%{name}*.1*
d7490e8
%{_datadir}/appdata/%{name}.appdata.xml
d7490e8
%{_datadir}/applications/%{name}.desktop
d7490e8
%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
d7490e8
d7490e8
d7490e8
d7490e8
%changelog
83f8948
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.7-8
83f8948
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
83f8948
893dba9
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.7-7
893dba9
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
893dba9
062bf20
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.7-6
062bf20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
062bf20
6fd2e1e
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.7-5
6fd2e1e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
6fd2e1e
041bf0a
* Sun Jan 25 2015 David King <amigadave@amigadave.com> - 1.7-4
041bf0a
- Apply patch from Debian to run with wxPython 3.0 (#1185599)
041bf0a
ac05d93
* Thu Jan 08 2015 David King <amigadave@amigadave.com> - 1.7-3
ac05d93
- Validate AppData in check
4411906
- Update man page glob in files section
ac05d93
f836141
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.7-2
f836141
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
f836141
d7490e8
* Mon May 19 2014 David King <amigadave@amigadave.com> - 1.7-1
d7490e8
- Initial import (#1076186)