6883bdf
%global commit0     fdc29c79eb6f3228897cfb713e047bf1d9a48198
6883bdf
%global date0       20160229
6883bdf
94a9462
%global srcname     qutepart
94a9462
%global sum         Code editor widget
9d5c42f
%global desc_common \
9d5c42f
Qutepart is a code editor widget for PyQt. Features: \
9d5c42f
    - Syntax highlighting for 196 languages. \
9d5c42f
    - Smart indentation for many languages. \
9d5c42f
    - Line numbers. \
9d5c42f
    - Bookmarks. \
9d5c42f
    - Advanced edit operations. \
9d5c42f
    - Matching braces highlighting. \
9d5c42f
    - Autocompletion based on document content. \
9d5c42f
    - Marking too long lines with red line. \
9d5c42f
    - Rectangular selection and copy-paste. \
9d5c42f
    - Linter marks support.
9d5c42f
6883bdf
# python3 is default in Fedoras, python2 still for EPEL
94a9462
%if 0%{?fedora}
94a9462
%bcond_without      python3
6883bdf
%bcond_with         python2
6883bdf
%else
6883bdf
%bcond_with         python3
6883bdf
%bcond_without      python2
94a9462
%endif
94a9462
94a9462
Name:           python-%{srcname}
9d5c42f
Version:        2.2.3
6883bdf
Release:        1.%{date0}git%(c=%{commit0}; echo ${c:0:7})%{?dist}
94a9462
Summary:        %{sum}
94a9462
94a9462
License:        LGPLv2+
94a9462
URL:            https://github.com/hlamer/%{srcname}
94a9462
6883bdf
Source0:        %{url}/archive/%{commit0}.tar.gz#/%{srcname}-%{commit0}.tar.gz
6883bdf
#v%{version}.tar.gz#/%{srcname}-%{version}.tar.gz
94a9462
94a9462
BuildRequires:  pcre-devel
94a9462
Requires:       pcre
94a9462
94a9462
BuildRequires:  PyQt4
94a9462
Requires:       PyQt4
94a9462
94a9462
BuildRequires:  python2-devel >= 2.7
94a9462
BuildRequires:  python-setuptools
94a9462
BuildRequires:  python-sphinx
94a9462
94a9462
%if 0%{with python3}
94a9462
BuildRequires:  python3-qt5
94a9462
Requires:       python3-qt5
94a9462
94a9462
BuildRequires:  python3-devel
94a9462
BuildRequires:  python3-setuptools
94a9462
BuildRequires:  python3-sphinx
94a9462
%endif
94a9462
94a9462
BuildRequires:  xorg-x11-server-Xvfb
94a9462
94a9462
%description
9d5c42f
%{desc_common}
94a9462
94a9462
94a9462
%package -n python2-%{srcname}
94a9462
Summary:        %{sum}
94a9462
%{?python_provide:%python_provide python2-%{srcname}}
94a9462
94a9462
%description -n python2-%{srcname}
9d5c42f
%{desc_common}
94a9462
94a9462
94a9462
%package -n python3-%{srcname}
94a9462
Summary:        %{sum}
94a9462
%{?python_provide:%python_provide python3-%{srcname}}
6883bdf
%if 0%{?fedora} >= 24
6883bdf
Obsoletes:      python2-%{srcname}
6883bdf
%endif
94a9462
94a9462
%description -n python3-%{srcname}
9d5c42f
%{desc_common}
94a9462
94a9462
94a9462
%prep
6883bdf
%setup -q -n %{srcname}-%{commit0}
94a9462
94a9462
%if 0%{with python3}
6883bdf
mkdir py3
6883bdf
find -mindepth 1 -maxdepth 1 -not -name py3 |xargs cp -pr -tpy3
6883bdf
pushd py3
6883bdf
94a9462
# FIXME dirty hacks to prevent gcc errors cause of c-api change in python3
6883bdf
#sed -i /ob_type/d %{srcname}/syntax/cParser.c
6883bdf
#sed -i -r 's,PyString_AsString\((.*)\).*;,\1;,' %{srcname}/syntax/cParser.c
94a9462
# disable PyQt5 mocking for sphinx
94a9462
sed -i -r 's,(MOCK_MODULES = \[).*\],\1],' doc/source/conf.py
6883bdf
94a9462
# disable sloppy tests
6883bdf
pushd tests
6883bdf
#rm test_bookmarks.py
6883bdf
#rm test_bracket_hlighter.py
6883bdf
#rm test_completion.py
6883bdf
#rm test_edit.py
94a9462
popd
6883bdf
6883bdf
popd # py3
94a9462
%endif
94a9462
94a9462
94a9462
%build
6883bdf
%if %{with python2}
94a9462
# we need CFLAGS for internal gcc call, py2_build sets them
94a9462
%py2_build
94a9462
pushd doc
94a9462
sphinx-build source html
94a9462
popd
6883bdf
%endif
94a9462
94a9462
%if 0%{with python3}
6883bdf
pushd py3
94a9462
%py3_build
94a9462
pushd doc
94a9462
sphinx-build-3 source html
94a9462
popd
94a9462
popd
94a9462
%endif
94a9462
94a9462
# E: non-standard-executable-perm
94a9462
find -name \*.so |xargs chmod 0755
94a9462
# W: hidden-file-or-dir
94a9462
find -name html -exec rm -r '{}'/.buildinfo '{}'/.doctrees \;
94a9462
94a9462
94a9462
%install
6883bdf
%if %{with python2}
94a9462
%py2_install
6883bdf
%endif
94a9462
94a9462
%if 0%{with python3}
6883bdf
pushd py3
94a9462
%py3_install
6883bdf
popd
94a9462
%endif
94a9462
94a9462
94a9462
%check
1c1d1e3
# ignore those really weird "fatal warnings" from dbus to not confuse tests
1c1d1e3
export DBUS_FATAL_WARNINGS=0
1c1d1e3
6883bdf
%if %{with python2}
94a9462
pushd tests
94a9462
# do some fake X 
94a9462
xvfb-run %{__python2} run_all.py
94a9462
popd
6883bdf
%endif
94a9462
94a9462
%if 0%{with python3}
6883bdf
pushd py3/tests
94a9462
xvfb-run -a %{__python3} run_all.py
94a9462
%endif
94a9462
94a9462
6883bdf
%if %{with python2}
94a9462
%files -n python2-%{srcname}
94a9462
%license LICENSE
94a9462
%doc README.md ChangeLog todo.txt
94a9462
%doc doc/html/
94a9462
%{python2_sitearch}/%{srcname}*
6883bdf
%endif
94a9462
94a9462
94a9462
%if 0%{with python3}
94a9462
%files -n python3-%{srcname}
94a9462
%license LICENSE
94a9462
%doc README.md ChangeLog todo.txt
6883bdf
%doc py3/doc/html/
94a9462
%{python3_sitearch}/%{srcname}*
94a9462
%endif
94a9462
94a9462
94a9462
%changelog
6883bdf
* Wed Mar 02 2016 Raphael Groner <projects.rg@smart.ms> - 2.2.3-1.20160229gitfdc29c7
6883bdf
- use upstream master as post-release
6883bdf
9d5c42f
* Sun Feb 28 2016 Raphael Groner <projects.rg@smart.ms> - 2.2.3-1
9d5c42f
- new version
6883bdf
- use main version for python3, get rid of py3 patches
6883bdf
- obsolete python2 package in Fedora 24+
9d5c42f
61394a0
* Sat Feb 27 2016 Raphael Groner <projects.rg@smart.ms> - 2.2.2-6
083da82
- rebuild to validate dependencies (bug with librsvg-2.so.2)
083da82
76904ae
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.2-5
76904ae
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
76904ae
fa209dc
* Thu Nov 12 2015 Kalev Lember <klember@redhat.com> - 2.2.2-4
fa209dc
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
fa209dc
94a9462
* Fri Nov 06 2015 Raphael Groner <projects.rg@smart.ms> - 2.2.2-3
94a9462
- add subpackages for python versioning
94a9462
- experimental python3 support
94a9462
94a9462
* Mon Oct 19 2015 Raphael Groner <projects.rg@smart.ms> - 2.2.2-2
94a9462
- take over from Jairo Llopis
94a9462
- cleanup generally
94a9462
- use LGPLv2 with "or later"
94a9462
- add more documentation files
94a9462
- execute tests
94a9462
- fix permissions
94a9462
- use new python macros
94a9462
- use virtual provides of python2 module
94a9462
94a9462
* Fri Aug 28 2015 Jairo Llopis <yajo.sk8@gmail.com> 2.2.2-1
94a9462
- New upstream version.
94a9462
94a9462
* Wed Aug 26 2015 Jairo Llopis <yajo.sk8@gmail.com> 2.2.0-7
94a9462
- Fix some permissions.
94a9462
- Remove Spanish descriptions, for easier maintenance.
94a9462
94a9462
* Mon May 4 2015 Jairo Llopis <yajo.sk8@gmail.com> 2.2.0-6
94a9462
- Fix license macro in SPEC.
94a9462
- Fix a couple of redundancies in SPEC.
94a9462
94a9462
* Thu Apr 30 2015 Jairo Llopis <yajo.sk8@gmail.com> 2.2.0-5
94a9462
- New upstream version.
94a9462
- Clear SPEC redundancies.
94a9462
- Force usage of Python 2 macros in SPEC.
94a9462
94a9462
* Fri Feb 6 2015 Jairo Llopis <yajo.sk8@gmail.com> 2.1.0-4
94a9462
- New upstream version.
94a9462
- Update descriptions and dependencies to match upstream SPEC.
94a9462
- Remove support for Fedora < 20.
94a9462
94a9462
* Mon Jul 7 2014 Jairo Llopis <yajo.sk8@gmail.com> 1.3.0-3
94a9462
- New upstream version.
94a9462
- Fix typo.
94a9462
94a9462
* Fri Oct 25 2013 Jairo Llopis <yajo.sk8@gmail.com> 1.1.0-2
94a9462
- Fix comments.
94a9462
- Fix translation.
94a9462
- Fix CFLAGS when building.
94a9462
- Fix license.
94a9462
94a9462
* Sun Sep 8 2013 Jairo Llopis <yajo.sk8@gmail.com>  1.1.0-1
94a9462
- Initial release.