summaryrefslogtreecommitdiff
path: root/engine/SCons/Tool/packaging/ipk.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2019-08-11 12:17:57 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2019-08-11 12:17:57 +0200
commitc8ea3b672655ddab746a7aea5a50217057b02b9e (patch)
tree01a0e712f4cf32c7140cf1a4ae14db4da4202253 /engine/SCons/Tool/packaging/ipk.py
parentca7be46fc0013fc037a045b6d4df73776461e821 (diff)
parentf6c9bffb15e04ea412db4df22a3851448221b85a (diff)
Diffstat (limited to 'engine/SCons/Tool/packaging/ipk.py')
-rw-r--r--engine/SCons/Tool/packaging/ipk.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/engine/SCons/Tool/packaging/ipk.py b/engine/SCons/Tool/packaging/ipk.py
index 78af950..27657eb 100644
--- a/engine/SCons/Tool/packaging/ipk.py
+++ b/engine/SCons/Tool/packaging/ipk.py
@@ -2,8 +2,8 @@
"""
#
-# 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
# "Software"), to deal in the Software without restriction, including
@@ -24,11 +24,13 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/packaging/ipk.py 74b2c53bc42290e911b334a6b44f187da698a668 2017/11/14 13:16:53 bdbaddog"
+__revision__ = "src/engine/SCons/Tool/packaging/ipk.py 72ae09dc35ac2626f8ff711d8c4b30b6138e08e3 2019-08-08 14:50:06 bdeegan"
+
+import os
import SCons.Builder
import SCons.Node.FS
-import os
+import SCons.Util
from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot
@@ -115,15 +117,17 @@ def build_specfiles(source, target, env):
#
#
opened_files={}
- def open_file(needle, haystack):
+ def open_file(needle, haystack=None):
try:
return opened_files[needle]
except KeyError:
- file=filter(lambda x: x.get_path().rfind(needle)!=-1, haystack)[0]
- opened_files[needle]=open(file.get_abspath(), 'w')
+ files = filter(lambda x: x.get_path().rfind(needle) != -1, haystack)
+ # Py3: filter returns an iterable, not a list
+ file = list(files)[0]
+ opened_files[needle] = open(file.get_abspath(), 'w')
return opened_files[needle]
- control_file=open_file('control', target)
+ control_file = open_file('control', target)
if 'X_IPK_DESCRIPTION' not in env:
env['X_IPK_DESCRIPTION']="%s\n %s"%(env['SUMMARY'],
@@ -145,7 +149,7 @@ Description: $X_IPK_DESCRIPTION
control_file.write(env.subst(content))
#
- # now handle the various other files, which purpose it is to set post-,
+ # now handle the various other files, which purpose it is to set post-,
# pre-scripts and mark files as config files.
#
# We do so by filtering the source files for files which are marked with
@@ -157,14 +161,14 @@ Description: $X_IPK_DESCRIPTION
# into the same named file.
#
for f in [x for x in source if 'PACKAGING_CONFIG' in dir(x)]:
- config=open_file('conffiles')
+ config = open_file('conffiles')
config.write(f.PACKAGING_INSTALL_LOCATION)
config.write('\n')
for str in 'POSTRM PRERM POSTINST PREINST'.split():
name="PACKAGING_X_IPK_%s"%str
for f in [x for x in source if name in dir(x)]:
- file=open_file(name)
+ file = open_file(name)
file.write(env[str])
#