Skip to content

Commit 9c2880e

Browse files
committed
setup: Rework 'rpm' command slightly
- Use subprocess - Return error on failure - Force output in the source directory - Drop the /tmp spec handling which was an artifact of my local config Signed-off-by: Cole Robinson <[email protected]>
1 parent d899472 commit 9c2880e

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

setup.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ def run(self):
6464

6565

6666
class RPMCommand(Command):
67-
description = "Build src and binary rpms."
67+
description = ("Build src and binary rpms and output them "
68+
"in the source directory")
6869
user_options = []
6970

7071
def initialize_options(self):
@@ -73,17 +74,15 @@ def finalize_options(self):
7374
pass
7475

7576
def run(self):
76-
"""
77-
Run sdist, then 'rpmbuild' the tar.gz
78-
"""
79-
os.system("cp python-bugzilla.spec /tmp")
80-
try:
81-
os.system("rm -rf python-bugzilla-%s" % get_version())
82-
self.run_command('sdist')
83-
os.system('rpmbuild -ta --clean dist/python-bugzilla-%s.tar.gz' %
84-
get_version())
85-
finally:
86-
os.system("mv /tmp/python-bugzilla.spec .")
77+
self.run_command('sdist')
78+
srcdir = os.path.dirname(__file__)
79+
cmd = [
80+
"rpmbuild", "-ta",
81+
"--define", "_rpmdir %s" % srcdir,
82+
"--define", "_srcrpmdir %s" % srcdir,
83+
"dist/python-bugzilla-%s.tar.gz" % get_version(),
84+
]
85+
subprocess.check_call(cmd)
8786

8887

8988
class BuildCommand(distutils.command.build.build):

0 commit comments

Comments
 (0)