summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2020-07-17 14:16:18 -0400
committerCole Robinson <crobinso@redhat.com>2020-07-17 16:00:32 -0400
commitb9dfd92bf081de4b2b5f6a0483f8730cb7a25367 (patch)
treedd062eaad9fd9070e0f3a921e0ef333947d249fa /setup.py
parent4226a4c1d55bc15997816c787b16c8b4a88488b3 (diff)
downloadvirt-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-xsetup.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/setup.py b/setup.py
index 97de8da2..9c4318f4 100755
--- a/setup.py
+++ b/setup.py
@@ -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):