diff options
author | Cole Robinson <crobinso@redhat.com> | 2020-07-17 14:16:18 -0400 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2020-07-17 16:00:32 -0400 |
commit | b9dfd92bf081de4b2b5f6a0483f8730cb7a25367 (patch) | |
tree | dd062eaad9fd9070e0f3a921e0ef333947d249fa /setup.py | |
parent | 4226a4c1d55bc15997816c787b16c8b4a88488b3 (diff) | |
download | virt-manager-b9dfd92bf081de4b2b5f6a0483f8730cb7a25367.tar.gz |
setup: Force 'rpm' to output to the git dir
And modernize it to use subprocess and report error output
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Diffstat (limited to 'setup.py')
-rwxr-xr-x | setup.py | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -12,6 +12,7 @@ if sys.version_info.major < 3: import glob import os from pathlib import Path +import subprocess import distutils import distutils.command.build @@ -302,7 +303,7 @@ class my_sdist(distutils.command.sdist.sdist): class my_rpm(distutils.core.Command): user_options = [] - description = "Build src and noarch rpms." + description = "Build RPMs and output to the source directory." def initialize_options(self): pass @@ -310,12 +311,16 @@ class my_rpm(distutils.core.Command): pass def run(self): - """ - Run sdist, then 'rpmbuild' the tar.gz - """ self.run_command('sdist') - os.system('rpmbuild -ta --clean dist/virt-manager-%s.tar.gz' % - BuildConfig.version) + srcdir = os.path.dirname(__file__) + cmd = [ + "rpmbuild", "-ta", + "--define", "_rpmdir %s" % srcdir, + "--define", "_srcrpmdir %s" % srcdir, + "--define", "_specdir /tmp", + "dist/virt-manager-%s.tar.gz" % BuildConfig.version, + ] + subprocess.check_call(cmd) class configure(distutils.core.Command): |