e8b441e
%if 0%{?fedora} || 0%{?rhel} > 7
e8b441e
# Enable python3 by default
e8b441e
%bcond_without python3
f3ddf43
%else
e8b441e
%bcond_with python3
e8b441e
%endif
e8b441e
e8b441e
%if 0%{?rhel} > 7
e8b441e
# Disable python2 build by default
e8b441e
%bcond_with python2
e8b441e
%else
e8b441e
%bcond_without python2
f3ddf43
%{!?__python2: %global __python2 /usr/bin/python2}
e8b441e
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
f3ddf43
%endif
d27fad4
d27fad4
Name:           python-bugzilla
e8b441e
Version:        2.2.0
ebe1c86
Release:        1%{?dist}.1
e8b441e
Summary:        Python library for interacting with Bugzilla
d27fad4
d27fad4
License:        GPLv2+
29679f5
URL:            https://github.com/python-bugzilla/python-bugzilla
29679f5
Source0:        https://github.com/python-bugzilla/python-bugzilla/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
d27fad4
BuildArch:      noarch
d27fad4
e8b441e
%if %{with python2}
f3ddf43
BuildRequires: python2-devel
e8b441e
BuildRequires: python2-requests
e8b441e
BuildRequires: python2-setuptools
e8b441e
BuildRequires: python2-pytest
e8b441e
%endif # with python2
2d4b77c
e8b441e
%if %{with python3}
f3ddf43
BuildRequires: python3-devel
f3ddf43
BuildRequires: python3-requests
253b88a
BuildRequires: python3-setuptools
e8b441e
BuildRequires: python3-pytest
f3ddf43
%endif # if with_python3
f3ddf43
e8b441e
%global _description\
e8b441e
python-bugzilla is a python library for interacting with bugzilla instances\
e8b441e
over XML-RPC.\
e8b441e
e8b441e
%description %_description
e8b441e
e8b441e
e8b441e
%if %{with python2}
e8b441e
%package -n python2-bugzilla
e8b441e
Summary: %summary
e8b441e
Requires: python2-requests
ebe1c86
Requires: python-magic
2a54754
# This dep is for back compat, so that installing python-bugzilla continues
2a54754
# to give the cli tool
2a54754
Requires: python-bugzilla-cli
e8b441e
%{?python_provide:%python_provide python2-bugzilla}
b5afbd6
e8b441e
%description -n python2-bugzilla %_description
f3ddf43
e8b441e
%endif # with python2
d27fad4
f3ddf43
e8b441e
%if %{with python3}
f3ddf43
%package -n python3-bugzilla
e8b441e
Summary: %summary
c787773
Requires: python3-requests
c787773
Requires: python3-magic
e8b441e
%{?python_provide:%python_provide python3-bugzilla}
e8b441e
e8b441e
%if %{without python2}
e8b441e
Obsoletes:      python-bugzilla < %{version}-%{release}
e8b441e
Obsoletes:      python2-bugzilla < %{version}-%{release}
e8b441e
%endif # without python2
f3ddf43
e8b441e
%description -n python3-bugzilla %_description
f3ddf43
%endif # if with_python3
f3ddf43
f3ddf43
2a54754
%package cli
2a54754
Summary: Command line tool for interacting with Bugzilla
e8b441e
%if %{with python3}
2a54754
Requires: python3-bugzilla = %{version}-%{release}
2a54754
%else
e8b441e
Requires: python2-bugzilla = %{version}-%{release}
2a54754
%endif
2a54754
2a54754
%description cli
2a54754
This package includes the 'bugzilla' command-line tool for interacting with bugzilla. Uses the python-bugzilla API
2a54754
2a54754
2a54754
d27fad4
%prep
31df1be
%setup -q
d27fad4
e8b441e
%if %{with python3}
f3ddf43
rm -rf %{py3dir}
f3ddf43
cp -a . %{py3dir}
f3ddf43
%endif # with_python3
f3ddf43
d27fad4
2a54754
d27fad4
%build
e8b441e
%if %{with python3}
f3ddf43
pushd %{py3dir}
f3ddf43
%{__python3} setup.py build
f3ddf43
popd
f3ddf43
%endif # with_python3
f3ddf43
e8b441e
%if %{with python2}
f3ddf43
%{__python2} setup.py build
e8b441e
%endif # with python2
d27fad4
03d93e6
2a54754
d27fad4
%install
e8b441e
%if %{with python3}
f3ddf43
pushd %{py3dir}
f3ddf43
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
e8b441e
e8b441e
%if %{with python2}
c787773
rm %{buildroot}/usr/bin/bugzilla
e8b441e
%endif
e8b441e
f3ddf43
popd
f3ddf43
%endif # with_python3
486433c
e8b441e
%if %{with python2}
f3ddf43
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
e8b441e
%endif # with python2
486433c
2a54754
# Replace '#!/usr/bin/env python' with '#!/usr/bin/python2'
2a54754
# The format is ideal for upstream, but not a distro. See:
2a54754
# https://fedoraproject.org/wiki/Features/SystemPythonExecutablesUseSystemPython
e8b441e
%if %{with python3}
2a54754
%global python_env_path %{__python3}
2a54754
%else
2a54754
%global python_env_path %{__python2}
2a54754
%endif
2a54754
for f in $(find %{buildroot} -type f -executable -print); do
2a54754
    sed -i "1 s|^#!/usr/bin/.*|#!%{python_env_path}|" $f || :
2a54754
done
2a54754
2a54754
486433c
f3ddf43
%check
e8b441e
%if %{with python2}
e8b441e
pytest
e8b441e
%endif # with python2
e8b441e
%if %{with python3}
e8b441e
pytest-3
e8b441e
%endif # with python3
486433c
486433c
03d93e6
e8b441e
%if %{with python2}
e8b441e
%files -n python2-bugzilla
2a54754
%doc COPYING README.md NEWS.md
f3ddf43
%{python2_sitelib}/*
e8b441e
%endif # with python2
d27fad4
e8b441e
%if %{with python3}
f3ddf43
%files -n python3-bugzilla
2a54754
%doc COPYING README.md NEWS.md
f3ddf43
%{python3_sitelib}/*
f3ddf43
%endif # with_python3
253b88a
2a54754
%files cli
2a54754
%{_bindir}/bugzilla
2a54754
%{_mandir}/man1/bugzilla.1.gz
2a54754
f7e24aa
d27fad4
%changelog
ebe1c86
* Mon Aug 13 2018 Cole Robinson <crobinso@redhat.com> - 2.2.0-1.fc27.1
ebe1c86
- Fix python-magic dep
ebe1c86
e8b441e
* Sat Aug 11 2018 Cole Robinson <crobinso@redhat.com> - 2.2.0-1
e8b441e
- Rebased to version 2.2.0
e8b441e
- Port tests to pytest
e8b441e
- cli: --cert Client side certificate support (Tobias Wolter)
e8b441e
- cli: add ability to post comment while sending attachment (Jeff Mahoney)
e8b441e
- cli: Add --comment-tag option
e8b441e
- cli: Add info --active-components
e8b441e
- Add a raw Product.get wrapper API
e8b441e
- Don't traceback on missing cli command (bz #1513819)
e8b441e
- Fix bug.get with sub_components (bz #1503491)
e8b441e
- Fix uploading binary attachments (bz #1496821)
e8b441e
0873636
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.0-2
0873636
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
0873636
2a54754
* Thu Mar 30 2017 Cole Robinson <crobinso@redhat.com> - 2.1.0-1
2a54754
- Rebased to version 2.1.0
2a54754
- Support for bugzilla 5 API Keys (Dustin J. Mitchell)
2a54754
- bugzillarc can be used to set default URL for the cli tool
2a54754
- Revive update_flags wrapper
2a54754
- Bug fixes and minor improvements
2a54754
f7e24aa
* Wed Feb 08 2017 Cole Robinson <crobinso@redhat.com> - 2.0.0-1
f7e24aa
- Rebased to version 2.0.0
f7e24aa
- Several fixes for use with bugzilla 5
f7e24aa
- This release contains several smallish API breaks:
f7e24aa
- Bugzilla.bug_autorefresh now defaults to False
f7e24aa
- Credentials are now cached in ~/.cache/python-bugzilla/
f7e24aa
- bin/bugzilla was converted to argparse
f7e24aa
- bugzilla query --boolean_chart option is removed
f7e24aa
- Unify command line flags across sub commands
f7e24aa
f4fc5d8
* Tue Dec 13 2016 Charalampos Stratakis <cstratak@redhat.com> - 1.2.2-5
f4fc5d8
- Rebuild for Python 3.6
f4fc5d8
6abff22
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.2-4
6abff22
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
6abff22
42c2fce
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.2-3
42c2fce
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
42c2fce
Robert Kuska 847bf81
* Mon Nov 02 2015 Robert Kuska <rkuska@redhat.com> - 1.2.2-2
Robert Kuska 847bf81
- Rebuilt for Python3.5 rebuild
Robert Kuska 847bf81
29679f5
* Tue Sep 22 2015 Cole Robinson <crobinso@redhat.com> - 1.2.2-1
29679f5
- Rebased to version 1.2.2
29679f5
- Fix requests usage when ndg-httpsclient is installed (bz #1247158)
29679f5
- Fix errors with non-ascii usernames (bz #1264848)
29679f5
c9ed905
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-2
c9ed905
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
c9ed905
fa71969
* Fri May 22 2015 Cole Robinson <crobinso@redhat.com> - 1.2.1-1
fa71969
- Rebased to version 1.2.1
fa71969
- bin/bugzilla: Add --ensure-logged-in option
fa71969
- Fix get_products with bugzilla.redhat.com
fa71969
- A few other minor improvements
fa71969
253b88a
* Wed Apr 08 2015 Cole Robinson <crobinso@redhat.com> - 1.2.0-1
253b88a
- Rebased to version 1.2.0
253b88a
- Add bugzilla new/query/modify --field flag (Arun Babu Neelicattu)
253b88a
- API support for ExternalBugs (Arun Babu Neelicattu, Brian Bouterse)
253b88a
- Add new/modify --alias support (Adam Williamson)
253b88a
- Bugzilla.logged_in now returns live state (Arun Babu Neelicattu)
253b88a
- Fix getbugs API with latest Bugzilla releases
253b88a
7a363f5
* Wed Jun 18 2014 Cole Robinson <crobinso@redhat.com> - 1.1.0-2
7a363f5
- Fix tests on rawhide (bz #1106734)
dc0ce95
e394e8f
* Sun Jun 01 2014 Cole Robinson <crobinso@redhat.com> - 1.1.0-1
e394e8f
- Rebased to version 1.1.0
e394e8f
- Support for bugzilla tokens (Arun Babu Nelicattu)
e394e8f
- bugzilla: Add query/modify --tags
e394e8f
- bugzilla --login: Allow to login and run a command in one shot
e394e8f
- bugzilla --no-cache-credentials: Don't use or save cached credentials
e394e8f
  when using the CLI
e394e8f
- Show bugzilla errors when login fails
e394e8f
- Don't pull down attachments in bug.refresh(), need to get
e394e8f
  bug.attachments manually
e394e8f
- Add Bugzilla bug_autorefresh parameter.
e394e8f
375da6e
* Wed May 14 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 1.0.0-3
375da6e
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
375da6e
c787773
* Thu Mar 27 2014 Cole Robinson <crobinso@redhat.com> - 1.0.0-2
c787773
- /usr/bin/bugzilla should use python2 (bz #1081594)
c787773
f3ddf43
* Tue Mar 25 2014 Cole Robinson <crobinso@redhat.com> - 1.0.0-1
f3ddf43
- Rebased to version 1.0.0
f3ddf43
- Python 3 support (Arun Babu Neelicattu)
f3ddf43
- Port to python-requests (Arun Babu Neelicattu)
f3ddf43
- bugzilla: new: Add --keywords, --assigned_to, --qa_contact (Lon
f3ddf43
  Hohberger)
f3ddf43
- bugzilla: query: Add --quicksearch, --savedsearch
f3ddf43
- bugzilla: query: Support saved searches with --from-url
f3ddf43
- bugzilla: --sub-component support for all relevant commands
f3ddf43
2d4b77c
* Tue Nov 05 2013 Cole Robinson <crobinso@redhat.com> - 0.9.0-3
2d4b77c
- Drop unneeded setuptools dep
2d4b77c
455523f
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.0-2
455523f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
455523f
486433c
* Wed Jun 19 2013 Cole Robinson <crobinso@redhat.com> - 0.9.0-1
486433c
- Rebased to version 0.9.0
486433c
- bugzilla: modify: add --dependson (Don Zickus)
486433c
- bugzilla: new: add --groups option (Paul Frields)
486433c
- bugzilla: modify: Allow setting nearly every bug parameter
486433c
- NovellBugzilla implementation removed, can't get it to work
486433c
- Gracefully handle private bugs (bz #963979)
486433c
- Raise error if python-magic is needed (bz #951572)
486433c
- CVE-2013-2191: Add SSL host and cert validation (bz #975961, bz #951594)
486433c
3b06420
* Mon Mar 04 2013 Cole Robinson <crobinso@redhat.com> - 0.8.0-2
3b06420
- Don't upload scrambled attachments (bz #915318)
3b06420
c479f83
* Fri Feb 15 2013 Cole Robinson <crobinso@redhat.com> - 0.8.0-1
c479f83
- Rebased to version 0.8.0
c479f83
- Drop most usage of non-upstream RH Bugzilla API
c479f83
- Test suite improvements, nearly complete code coverage
c479f83
- Fix all open bug reports and RFEs
c479f83
bfacfc6
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.0-4
bfacfc6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
bfacfc6
762722e
* Thu Jan 03 2013 Adam Jackson <ajax@redhat.com> 0.7.0-3
762722e
- Make closing bugs work, and allow closing as duplicate.
762722e
b6d3ba4
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.0-2
b6d3ba4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
b6d3ba4
2bb018d
* Wed Jun 06 2012 Cole Robinson <crobinso@redhat.com> - 0.7.0-1
2bb018d
- Rebased to version 0.7.0
2bb018d
- Fix querying with latest Red Hat bugzilla
2bb018d
- Bugzilla 4 API support
2bb018d
- Improve querying non-RH bugzilla instances
2bb018d
66ca04e
* Tue Apr  3 2012 Peter Robinson <pbrobinson@fedoraproject.org> - 0.6.2-4
66ca04e
- Cleanup spec and actually rebuild
66ca04e
e7cbc6f
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.2-3
e7cbc6f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
e7cbc6f
f480cdf
* Thu Jun 09 2011 Will Woods <wwoods@redhat.com> - 0.6.2-2
f480cdf
- Add "Requires: python-magic"
f480cdf
0946d77
* Tue Jun 07 2011 Will Woods <wwoods@redhat.com> - 0.6.2-1
0946d77
- add 'bugzilla attach' command (#707320)
0946d77
- update CLI --help, improve manpage a bit
0946d77
- fix --blocked and other boolean CLI options (#621601)
0946d77
- use NamedTemporaryFile for temp. cookiefiles (#625019)
0946d77
- fix openattachment() on non-ascii filenames (#663674 - thanks kklic)
0946d77
- clean up handling of unknown product names (#659331)
0946d77
- misc CLI fixes (--oneline, --qa_whiteboard), add 'modify --qa_contact'
0946d77
621b0cc
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.1-4
621b0cc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
621b0cc
e13b328
* Thu Aug  5 2010 David Malcolm <dmalcolm@redhat.com> - 0.6.1-3
e13b328
- add compatibility patch for python 2.7 (bug 621298)
e13b328
9083cc6
* Wed Jul 21 2010 David Malcolm <dmalcolm@redhat.com> - 0.6.1-2
9083cc6
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
9083cc6
269e4f3
* Fri Apr 16 2010 Will Woods <wwoods@redhat.com> - 0.6.1-1
269e4f3
- CLI speedup: skip version autodetection for bugzilla.redhat.com
269e4f3
- CLI: fix bug 581670 - UnicodeEncodeError crash using --outputformat
269e4f3
- CLI: fix bug 549186 - parser failure/xmlrpc Fault on 'bugzilla query'
269e4f3
- Library: fix bug 577327 - crash changing assignee without --comment
269e4f3
- Library: fix bug 580711 - crash when bug has empty CC list
269e4f3
- Library: add new Bugzilla36 class
269e4f3
- Library: export and autodetect Bugzilla34 and Bugzilla36 classes
269e4f3
3418463
* Tue Mar 2 2010 Will Woods <wwoods@redhat.com> - 0.6.0-1
3418463
- New version 0.6, with lots of improvements and fixes.
3418463
- Library: add NovellBugzilla implementation
3418463
- Library: use standardized LWPCookieJar by default
3418463
- Library: implement unicode(bug), fix Bug.__str__ unicode handling
3418463
- Library: make Bug class pickle-friendly
3418463
- Library: add flag info helper methods to Bug class
3418463
- Library: handle problems with missing fields in User class
3418463
- CLI: --oneline formatting tweaks and dramatic speed improvements
3418463
- CLI: add support for modifying private, status, assignee, flags, cc, fixed_in
3418463
- CLI: improve query: allow multiple flags, flag negation, handle booleans
3418463
- CLI: make --cc work when creating bugs
3418463
- CLI: new --raw output style
3418463
- CLI: special output format fields for flag and whiteboard
3418463
- CLI: fix broken --cc and -p flags
3418463
- CLI: fix problem where bz comments default to being private
3418463
- CLI: improve 'info --product' output
3418463
- CLI: handle socket/network failure cleanly
3418463
- CLI: allow adding comments when updating whiteboards
3418463
ac29521
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.1-3
ac29521
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
ac29521
0ce8345
* Tue Apr 14 2009 Will Woods <wwoods@redhat.com> - 0.5.1-2
0ce8345
- Fix missing util.py
0ce8345
36fed7b
* Thu Apr 9 2009 Will Woods <wwoods@redhat.com> - 0.5.1-1
36fed7b
- CLI: fix unicode handling
36fed7b
- CLI: add --from-url flag, which parses a bugzilla query.cgi URL
36fed7b
- CLI: fix showing aliases
36fed7b
- CLI: add --comment, --private, --status, --assignee, --flag, --cc for update
36fed7b
- CLI: fix --target_milestone
36fed7b
31df1be
* Wed Mar 25 2009 Will Woods <wwoods@redhat.com> - 0.5-1
31df1be
- Fix problem where login wasn't saving the cookies to a file 
31df1be
- Fix openattachment (bug #487673)
31df1be
- Update version number for 0.5 final
31df1be
c282ea6
* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5-0.rc1.1
c282ea6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
c282ea6
31df1be
* Thu Feb 12 2009 Will Woods <wwoods@redhat.com> 0.5-0.rc1
6dfa806
- Improve cookie handling
6dfa806
- Add User class and associated Bugzilla methods (in Bugzilla 3.4)
6dfa806
- Add {add,edit,get}component methods
6dfa806
- Fix getbugs() so a single invalid bug ID won't abort the whole request
6dfa806
- CLI: fix -c <component>
6dfa806
446365b
* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 0.4-0.rc4.1
446365b
- Rebuild for Python 2.6
446365b
b9e7d0f
* Wed Oct 15 2008 Will Woods <wwoods@redhat.com> 0.4-0.rc4
b9e7d0f
- CLI: fix traceback with --full (Don Zickus)
b9e7d0f
- CLI: add --oneline (Don Zickus)
b9e7d0f
- CLI: speedup when querying bugs by ID (Don Zickus)
b9e7d0f
- CLI: add --bztype
b9e7d0f
- CLI: --bug_status defaults to ALL
b9e7d0f
- Fix addcc()/deletecc()
b9e7d0f
- RHBugzilla3: raise useful error on getbug(unreadable_bug_id)
b9e7d0f
- Add adduser() (Jon Stanley)
b9e7d0f
486433c
* Wed Oct  8 2008 Will Woods <wwoods@redhat.com> 0.4-0.rc3
03d93e6
- Add updateperms() - patch courtesy of Jon Stanley
03d93e6
- Fix attachfile() for RHBugzilla3
03d93e6
- Actually install man page. Whoops.
03d93e6
298318c
* Thu Sep 18 2008 Will Woods <wwoods@redhat.com> 0.4-0.rc2
298318c
- Auto-generated man page with much more info
298318c
- Fix _attachfile()
298318c
cabcb1c
* Thu Sep  4 2008 Will Woods <wwoods@redhat.com> 0.4-0.rc1
cabcb1c
- Update to python-bugzilla 0.4-rc1
cabcb1c
- We now support upstream Bugzilla 3.x and Red Hat's Bugzilla 3.x instance
cabcb1c
- library saves login cookie in ~/.bugzillacookies
cabcb1c
- new 'bugzilla login' command to get a login cookie
cabcb1c
d50f252
* Sat Jan 12 2008 Will Woods <wwoods@redhat.com> 0.3-1
d50f252
- Update to python-bugzilla 0.3 
d50f252
- 'modify' works in the commandline-util
d50f252
- add Bug.close() and Bug.setstatus()
d50f252
d27fad4
* Thu Dec 13 2007 Will Woods <wwoods@redhat.com> 0.2-4
d27fad4
- use _bindir instead of /usr/bin and proper BR for setuptools
d27fad4
d27fad4
* Tue Dec 11 2007 Will Woods <wwoods@redhat.com> 0.2-3
d27fad4
- Fix a couple of things rpmlint complained about
d27fad4
d27fad4
* Tue Dec 11 2007 Will Woods <wwoods@redhat.com> 0.2-2
d27fad4
- Add docs
d27fad4
d27fad4
* Wed Oct 10 2007 Will Woods <wwoods@redhat.com> 0.2-1
d27fad4
- Initial packaging.