summaryrefslogtreecommitdiff
path: root/src/engine/SCons/Tool/rpm.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/Tool/rpm.py')
-rw-r--r--src/engine/SCons/Tool/rpm.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/engine/SCons/Tool/rpm.py b/src/engine/SCons/Tool/rpm.py
index 5cd97b3..0253365 100644
--- a/src/engine/SCons/Tool/rpm.py
+++ b/src/engine/SCons/Tool/rpm.py
@@ -11,7 +11,7 @@ tar.gz consisting of the source file and a specfile.
"""
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -33,7 +33,7 @@ tar.gz consisting of the source file and a specfile.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/rpm.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Tool/rpm.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import os
import re
@@ -51,43 +51,44 @@ def get_cmd(source, env):
if SCons.Util.is_List(source):
tar_file_with_included_specfile = source[0]
return "%s %s %s"%(env['RPM'], env['RPMFLAGS'],
- tar_file_with_included_specfile.get_abspath() )
+ tar_file_with_included_specfile.get_abspath())
def build_rpm(target, source, env):
# create a temporary rpm build root.
- tmpdir = os.path.join( os.path.dirname( target[0].get_abspath() ), 'rpmtemp' )
+ tmpdir = os.path.join(os.path.dirname(target[0].get_abspath()), 'rpmtemp')
if os.path.exists(tmpdir):
shutil.rmtree(tmpdir)
# now create the mandatory rpm directory structure.
for d in ['RPMS', 'SRPMS', 'SPECS', 'BUILD']:
- os.makedirs( os.path.join( tmpdir, d ) )
+ os.makedirs(os.path.join(tmpdir, d))
# set the topdir as an rpmflag.
- env.Prepend( RPMFLAGS = '--define \'_topdir %s\'' % tmpdir )
+ env.Prepend(RPMFLAGS = '--define \'_topdir %s\'' % tmpdir)
# now call rpmbuild to create the rpm package.
handle = subprocess.Popen(get_cmd(source, env),
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=True)
- output = SCons.Util.to_str(handle.stdout.read())
+ with handle.stdout:
+ output = SCons.Util.to_str(handle.stdout.read())
status = handle.wait()
if status:
- raise SCons.Errors.BuildError( node=target[0],
- errstr=output,
- filename=str(target[0]) )
+ raise SCons.Errors.BuildError(node=target[0],
+ errstr=output,
+ filename=str(target[0]))
else:
# XXX: assume that LC_ALL=C is set while running rpmbuild
- output_files = re.compile( 'Wrote: (.*)' ).findall( output )
+ output_files = re.compile('Wrote: (.*)').findall(output)
- for output, input in zip( output_files, target ):
+ for output, input in zip(output_files, target):
rpm_output = os.path.basename(output)
expected = os.path.basename(input.get_path())
assert expected == rpm_output, "got %s but expected %s" % (rpm_output, expected)
- shutil.copy( output, input.get_abspath() )
+ shutil.copy(output, input.get_abspath())
# cleanup before leaving.