Ticket #3292: modern-tap2rpm-3292-3.patch

File modern-tap2rpm-3292-3.patch, 1.3 KB (added by TimAllen, 4 years ago)

Make tap2rpm quieter by running it with subprocess.Popen

  • twisted/scripts/tap2rpm.py

    diff --git a/twisted/scripts/tap2rpm.py b/twisted/scripts/tap2rpm.py
    index 3f55840..97ed546 100755
    a b  
    11# -*- test-case-name: twisted.scripts.test.test_tap2rpm -*- 
    22 
    3 # Copyright (c) 2003-2009 Twisted Matrix Laboratories. 
     3# Copyright (c) 2003-2010 Twisted Matrix Laboratories. 
    44# See LICENSE for details. 
    55 
    66import sys, os, shutil, time, glob 
     7import subprocess 
    78 
    89from twisted.python import usage 
    910from twisted.scripts import tap2deb 
    def run(options=None): 
    242243              % vars()) 
    243244     
    244245    #  build rpm 
    245     print 'Starting build...' 
    246     print '=' * 70 
    247     sys.stdout.flush() 
    248     os.system('rpmbuild --define "_topdir %s" -ta %s' % ( tmp_dir, tarfile_name )) 
    249     print 'Done with build...' 
    250     print '=' * 70 
     246    job = subprocess.Popen([ 
     247            "rpmbuild", 
     248            "--define", "_topdir %s" % (tmp_dir,), 
     249            "-ta", tarfile_name, 
     250        ], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 
     251    stdout, _ = job.communicate() 
     252 
     253    # If there was a problem, show people what it was. 
     254    if job.returncode != 0: 
     255        print stdout 
    251256     
    252257    #  copy the RPMs to the local directory 
    253258    rpm_path = glob.glob(os.path.join(tmp_dir, 'RPMS', 'noarch', '*'))[0]