f57736
%if 0%{?fedora}
f57736
%global with_python3 1
f57736
%else
a966c1
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
f57736
%endif
a966c1
8bf69c
%bcond_without python2
8bf69c
89b10b
%global modname q
89b10b
89b10b
Name:           python-%{modname}
89b10b
Version:        2.6
00e071
Release:        12%{?dist}
a966c1
Summary:        Quick and dirty python debugging output
a966c1
a966c1
License:        ASL 2.0
a966c1
URL:            https://pypi.python.org/pypi/q
89b10b
Source0:        https://files.pythonhosted.org/packages/source/%(n=%{modname}; echo ${n:0:1})/%{modname}/%{modname}-%{version}.tar.gz
89b10b
# https://github.com/zestyping/q/pull/28
89b10b
Patch0001:      0001-Alternate-pprint-for-values.patch
cafc16
Patch1000:      q-2.6-remove-setuptools-dep.patch
a966c1
89b10b
BuildArch:      noarch
a966c1
89b10b
%global _description \
89b10b
If you have ever been frustrated trying to debug with print because a web\
89b10b
application or a unittesting framework is swallowing your debugging output,\
89b10b
q will make you jump for joy.\
89b10b
\
89b10b
  import q\
89b10b
  variable = 'Hmmm... something happened here'\
8bf69c
  q.q(variable)\
89b10b
\
a966c1
cat /tmp/q
a966c1
89b10b
%description %{_description}
f57736
8bf69c
%if %{with python2}
89b10b
%package -n python2-%{modname}
89b10b
Summary:        %{summary}
89b10b
%{?python_provide:%python_provide python2-%{modname}}
89b10b
BuildRequires:  python2-devel
f57736
89b10b
%description -n python2-%{modname} %{_description}
f57736
89b10b
Python 2 version.
8bf69c
%endif
f57736
8bf69c
%if %{with_python3}
89b10b
%package -n python3-%{modname}
89b10b
Summary:        %{summary}
89b10b
%{?python_provide:%python_provide python3-%{modname}}
89b10b
BuildRequires:  python3-devel
a966c1
89b10b
%description -n python3-%{modname} %{_description}
a966c1
89b10b
Python 3 version.
8bf69c
%endif
244ed6
89b10b
%prep
89b10b
%autosetup -n %{modname}-%{version} -p1
a966c1
a966c1
%build
8bf69c
8bf69c
%if %{with python2}
89b10b
%py2_build
8bf69c
%endif
8bf69c
8bf69c
%if %{with_python3}
89b10b
%py3_build
8bf69c
%endif
a966c1
a966c1
%install
8bf69c
%if %{with python2}
89b10b
%py2_install
8bf69c
%endif
8bf69c
8bf69c
%if %{with_python3}
89b10b
%py3_install
8bf69c
%endif
a966c1
89b10b
%check
8bf69c
%if %{with python2}
89b10b
%{__python2} test/test_*.py -v
8bf69c
%endif
8bf69c
8bf69c
%if %{with_python3}
89b10b
%{__python3} test/test_*.py -v
8bf69c
%endif
f57736
8bf69c
%if %{with python2}
124685
%pretrans -p <lua> -n python2-%{modname}
124685
path = "%{python2_sitelib}/%{modname}-%{version}-py%{python2_version}.egg-info"
124685
st = posix.stat(path)
124685
if st and st.type == "directory" then
124685
  status = os.rename(path, path .. ".rpmmoved")
124685
  if not status then
124685
    suffix = 0
124685
    while not status do
124685
      suffix = suffix + 1
124685
      status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
124685
    end
124685
    os.rename(path, path .. ".rpmmoved")
124685
  end
124685
end
124685
%endif
124685
124685
%if %{with_python3}
124685
%pretrans -p <lua> -n python3-%{modname}
124685
path = "%{python3_sitelib}/q-2.6-py%{python3_version}.egg-info"
124685
st = posix.stat(path)
124685
if st and st.type == "directory" then
124685
  status = os.rename(path, path .. ".rpmmoved")
124685
  if not status then
124685
    suffix = 0
124685
    while not status do
124685
      suffix = suffix + 1
124685
      status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
124685
    end
124685
    os.rename(path, path .. ".rpmmoved")
124685
  end
124685
end
124685
%endif
124685
124685
%if %{with python2}
89b10b
%files -n python2-%{modname}
008c7e
%doc README.md
b839e8
%{python2_sitelib}/%{modname}-*.egg-info
89b10b
%{python2_sitelib}/%{modname}.py*
124685
%ghost %{python2_sitelib}/%{modname}-*.egg-info.rpmmoved/
8bf69c
%endif
a966c1
8bf69c
%if %{with_python3}
89b10b
%files -n python3-%{modname}
f57736
%doc README.md
b839e8
%{python3_sitelib}/%{modname}-*.egg-info
89b10b
%{python3_sitelib}/%{modname}.py
89b10b
%{python3_sitelib}/__pycache__/%{modname}.*
124685
%ghost %{python3_sitelib}/%{modname}-*.egg-info.rpmmoved/
8bf69c
%endif
a966c1
a966c1
%changelog
00e071
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.6-12
00e071
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
00e071
00db6f
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.6-11
00db6f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
00db6f
124685
* Tue Sep 18 2018 Toshio Kuratomi <toshio@fedoraproject.org> - - 2.6-10
124685
- Deal with rpm's inability to replace directories with files
124685
cafc16
* Tue Sep 18 2018 Toshio Kuratomi <toshio@fedoraproject.org> - - 2.6-9
cafc16
- Remove the setuptools dep as it doesn't add anything to the package and this way
cafc16
  we wouldn't have to keep setuptools running on the python2 stack.
cafc16
8bf69c
* Tue Sep 18 2018 Toshio Kuratomi <toshio@fedoraproject.org> - - 2.6-8
8bf69c
- Conditionalize the python2 and python3 builds.  This will allow the Python2
8bf69c
  build to be automatically omitted once Python2 is removed from Fedora and the
8bf69c
  spec file to be shared with EPEL builds.
8bf69c
719af0
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.6-7
719af0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
719af0
316adb
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 2.6-6
316adb
- Rebuilt for Python 3.7
316adb
1f4637
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.6-5
1f4637
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
1f4637
03964b
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.6-4
03964b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
03964b
f803b0
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.6-3
f803b0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
f803b0
1a9559
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 2.6-2
1a9559
- Rebuild for Python 3.6
1a9559
89b10b
* Thu Nov 17 2016 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2.6-1
89b10b
- Update to 2.6
89b10b
- Modernize spec
89b10b
- Run test suite
89b10b
bf5ca5
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5-6
bf5ca5
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
bf5ca5
5816ee
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.5-5
5816ee
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
5816ee
08222e
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5-4
08222e
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
08222e
818cf5
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5-3
818cf5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
818cf5
ace91d
* Fri Dec 12 2014 Toshio Kuratomi <toshio@fedoraproject.org> - 2.5-2
ace91d
- Add prettyprint of values
ace91d
- Make the tracing decorator more transparent
ace91d
aa3b7a
* Fri Dec  5 2014 Toshio Kuratomi <toshio@fedoraproject.org> - 2.5-1
aa3b7a
- New upstream version
aa3b7a
6275bd
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4-4
6275bd
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
6275bd
1ef9de
* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 2.4-3
1ef9de
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
1ef9de
aeb0bb
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4-2
aeb0bb
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
aeb0bb
f57736
* Wed May 22 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 2.4-1
f57736
- New upstream with some enhancements from severl people.
f57736
- Build with python3 support.
f57736
7077c1
* Thu Apr 11 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 2.3-2
008c7e
- New upstream release.
008c7e
- README file from upstream's SCM
008c7e
- Note patches we have for upstream
008c7e
a966c1
* Tue Mar 19 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 1.1-1
a966c1
- Initial Fedora build
a966c1
a966c1