Skip to content

Commit f7498b0

Browse files
committed
Add RPM spec file
1 parent b930cdf commit f7498b0

4 files changed

Lines changed: 87 additions & 3 deletions

File tree

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
include COPYING HACKING MANIFEST.in README
22
include bugzilla.1
33
include bz-api-notes.txt
4+
include python-bugzilla.spec
45
recursive-include tests *.py *.txt

python-bugzilla.spec

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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

setup.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff 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+
158179
setup(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
)

tests/misc.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import atexit
1313
import os
1414
import shutil
15+
import sys
1516
import unittest
1617

1718
import 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 "\npython 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")

0 commit comments

Comments
 (0)