File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11include COPYING HACKING MANIFEST.in README
22include bugzilla.1
33include bz-api-notes.txt
4+ include python-bugzilla.spec
45recursive-include tests *.py *.txt
Original file line number Diff line number Diff line change 1+ %{! ?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
2+
3+ Name: python-bugzilla
4+ Version: 0.8.0
5+ Release: 1%{?dist }
6+ Summary: A python library for interacting with Bugzilla
7+
8+ Group: Development/Languages
9+ License: GPLv2+
10+ URL: https://fedorahosted.org/python-bugzilla
11+ Source0: https://fedorahosted.org/releases/p/y/%{name }/%{name }-%{version }.tar.gz
12+ BuildArch: noarch
13+ BuildRoot: %{_tmppath }/%{name }-%{version }-%{release }-root-%(%{__id_u} -n)
14+
15+ BuildRequires: python-devel
16+ %if 0%{?rhel } == 5
17+ BuildRequires: python-setuptools
18+ %else
19+ BuildRequires: python-setuptools-devel
20+ %endif
21+
22+ Requires: python-magic
23+
24+ %description
25+ python-bugzilla is a python library for interacting with bugzilla instances
26+ over XML-RPC. This package also includes the 'bugzilla' command-line tool
27+ for interacting with bugzilla from shell scripts.
28+
29+ %prep
30+ %setup -q
31+
32+
33+ %build
34+ %{__python} setup.py build
35+
36+
37+ %install
38+ rm -rf $RPM_BUILD_ROOT
39+ %{__python} setup.py install -O1 --skip-build --root=$RPM_BUILD_ROOT
40+
41+
42+ %check
43+ python setup.py test
44+
45+
46+ %clean
47+ rm -rf $RPM_BUILD_ROOT
48+
49+
50+ %files
51+ %defattr(-,root,root,-)
52+ %doc COPYING README PKG-INFO
53+ %{python_sitelib }/*
54+ %{_bindir }/bugzilla
55+ %{_mandir }/man1/bugzilla.1.gz
Original file line number Diff line number Diff line change @@ -40,8 +40,11 @@ def finalize_options(self):
4040 def run (self ):
4141 os .environ ["__BUGZILLA_UNITTEST" ] = "1"
4242
43- import coverage
44- usecov = int (coverage .__version__ .split ("." )[0 ]) >= 3
43+ try :
44+ import coverage
45+ usecov = int (coverage .__version__ .split ("." )[0 ]) >= 3
46+ except :
47+ usecov = False
4548
4649 if usecov :
4750 cov = coverage .coverage (omit = ["/*/tests/*" , "/usr/*" ])
@@ -155,6 +158,24 @@ def run(self):
155158 "--ignore E303,E125,E128" )
156159
157160
161+ class RPMCommand (Command ):
162+ description = "Build src and binary rpms."
163+ user_options = []
164+
165+ def initialize_options (self ):
166+ pass
167+ def finalize_options (self ):
168+ pass
169+
170+ def run (self ):
171+ """
172+ Run sdist, then 'rpmbuild' the tar.gz
173+ """
174+ self .run_command ('sdist' )
175+ os .system ('rpmbuild -ta --clean dist/python-bugzilla-%s.tar.gz' %
176+ get_version ())
177+
178+
158179setup (name = 'python-bugzilla' ,
159180 version = get_version (),
160181 description = 'Bugzilla XMLRPC access module' ,
@@ -167,7 +188,8 @@ def run(self):
167188 data_files = [('share/man/man1' , ['bugzilla.1' ])],
168189
169190 cmdclass = {
170- "test" : TestCommand ,
171191 "pylint" : PylintCommand ,
192+ "rpm" : RPMCommand ,
193+ "test" : TestCommand ,
172194 }
173195)
Original file line number Diff line number Diff line change 1212import atexit
1313import os
1414import shutil
15+ import sys
1516import unittest
1617
1718import bugzilla
@@ -65,6 +66,11 @@ def testUserAgent(self):
6566 self .assertTrue (rhbz .user_agent .endswith ("RHBugzilla/0.1" ))
6667
6768 def testCookies (self ):
69+ if (sys .version_info [0 ] < 2 or
70+ (sys .version_info [0 ] == 2 and sys .version_info [1 ] < 6 )):
71+ print "\n python too old, skipping cookie test"
72+ return
73+
6874 cookiesbad = os .path .join (os .getcwd (), "tests/data/cookies-bad.txt" )
6975 cookieslwp = os .path .join (os .getcwd (), "tests/data/cookies-lwp.txt" )
7076 cookiesmoz = os .path .join (os .getcwd (), "tests/data/cookies-moz.txt" )
You can’t perform that action at this time.
0 commit comments