summaryrefslogtreecommitdiff
path: root/engine/SCons/Tool/packaging
diff options
context:
space:
mode:
Diffstat (limited to 'engine/SCons/Tool/packaging')
-rw-r--r--engine/SCons/Tool/packaging/__init__.py16
-rw-r--r--engine/SCons/Tool/packaging/ipk.py16
-rw-r--r--engine/SCons/Tool/packaging/msi.py23
-rw-r--r--engine/SCons/Tool/packaging/rpm.py10
-rw-r--r--engine/SCons/Tool/packaging/src_tarbz2.py2
-rw-r--r--engine/SCons/Tool/packaging/src_targz.py2
-rw-r--r--engine/SCons/Tool/packaging/src_tarxz.py2
-rw-r--r--engine/SCons/Tool/packaging/src_zip.py2
-rw-r--r--engine/SCons/Tool/packaging/tarbz2.py2
-rw-r--r--engine/SCons/Tool/packaging/targz.py2
-rw-r--r--engine/SCons/Tool/packaging/tarxz.py2
-rw-r--r--engine/SCons/Tool/packaging/zip.py2
12 files changed, 41 insertions, 40 deletions
diff --git a/engine/SCons/Tool/packaging/__init__.py b/engine/SCons/Tool/packaging/__init__.py
index af60e8b..72b9eef 100644
--- a/engine/SCons/Tool/packaging/__init__.py
+++ b/engine/SCons/Tool/packaging/__init__.py
@@ -25,7 +25,7 @@ SCons Packaging Tool.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-__revision__ = "src/engine/SCons/Tool/packaging/__init__.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
+__revision__ = "src/engine/SCons/Tool/packaging/__init__.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import SCons.Defaults
import SCons.Environment
@@ -35,11 +35,11 @@ from SCons.Util import is_List, make_path_relative
from SCons.Warnings import warn, Warning
import os
-import imp
+import importlib
__all__ = [
- 'src_targz', 'src_tarbz2', 'src_xz', 'src_zip',
- 'targz', 'tarbz2', 'xz', 'zip',
+ 'src_targz', 'src_tarbz2', 'src_tarxz', 'src_zip',
+ 'targz', 'tarbz2', 'tarxz', 'zip',
'rpm', 'msi', 'ipk',
]
@@ -122,12 +122,12 @@ def Package(env, target=None, source=None, **kw):
# load the needed packagers.
def load_packager(type):
try:
- file,path,desc=imp.find_module(type, __path__)
- return imp.load_module(type, file, path, desc)
+ # the specific packager is a relative import
+ return importlib.import_module("." + type, __name__)
except ImportError as e:
- raise EnvironmentError("packager %s not available: %s"%(type,str(e)))
+ raise SConsEnvironmentError("packager %s not available: %s" % (type, str(e)))
- packagers=list(map(load_packager, PACKAGETYPE))
+ packagers = list(map(load_packager, PACKAGETYPE))
# set up targets and the PACKAGEROOT
try:
diff --git a/engine/SCons/Tool/packaging/ipk.py b/engine/SCons/Tool/packaging/ipk.py
index 2ebc168..dbf5be8 100644
--- a/engine/SCons/Tool/packaging/ipk.py
+++ b/engine/SCons/Tool/packaging/ipk.py
@@ -3,7 +3,7 @@
#
# 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,7 +24,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/packaging/ipk.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
+__revision__ = "src/engine/SCons/Tool/packaging/ipk.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import os
@@ -117,17 +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:
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')
+ 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'],
@@ -149,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
@@ -161,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])
#
diff --git a/engine/SCons/Tool/packaging/msi.py b/engine/SCons/Tool/packaging/msi.py
index fbb8b21..4a48b47 100644
--- a/engine/SCons/Tool/packaging/msi.py
+++ b/engine/SCons/Tool/packaging/msi.py
@@ -25,7 +25,7 @@ The msi packager.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-__revision__ = "src/engine/SCons/Tool/packaging/msi.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
+__revision__ = "src/engine/SCons/Tool/packaging/msi.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import os
import SCons
@@ -188,7 +188,7 @@ def build_wxsfile(target, source, env):
""" Compiles a .wxs file from the keywords given in env['msi_spec'] and
by analyzing the tree of source nodes and their tags.
"""
- file = open(target[0].get_abspath(), 'w')
+ f = open(target[0].get_abspath(), 'w')
try:
# Create a document with the Wix root tag
@@ -209,7 +209,7 @@ def build_wxsfile(target, source, env):
build_license_file(target[0].get_dir(), env)
# write the xml to a file
- file.write( doc.toprettyxml() )
+ f.write( doc.toprettyxml() )
# call a user specified function
if 'CHANGE_SPECFILE' in env:
@@ -217,6 +217,8 @@ def build_wxsfile(target, source, env):
except KeyError as e:
raise SCons.Errors.UserError( '"%s" package field for MSI is missing.' % e.args[0] )
+ finally:
+ f.close()
#
# setup function
@@ -440,14 +442,13 @@ def build_license_file(directory, spec):
pass # ignore this as X_MSI_LICENSE_TEXT is optional
if name!='' or text!='':
- file = open( os.path.join(directory.get_path(), 'License.rtf'), 'w' )
- file.write('{\\rtf')
- if text!='':
- file.write(text.replace('\n', '\\par '))
- else:
- file.write(name+'\\par\\par')
- file.write('}')
- file.close()
+ with open(os.path.join(directory.get_path(), 'License.rtf'), 'w') as f:
+ f.write('{\\rtf')
+ if text!='':
+ f.write(text.replace('\n', '\\par '))
+ else:
+ f.write(name+'\\par\\par')
+ f.write('}')
#
# mandatory and optional package tags
diff --git a/engine/SCons/Tool/packaging/rpm.py b/engine/SCons/Tool/packaging/rpm.py
index 3f44d83..a948e29 100644
--- a/engine/SCons/Tool/packaging/rpm.py
+++ b/engine/SCons/Tool/packaging/rpm.py
@@ -25,7 +25,7 @@ The rpm packager.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-__revision__ = "src/engine/SCons/Tool/packaging/rpm.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
+__revision__ = "src/engine/SCons/Tool/packaging/rpm.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import os
@@ -125,11 +125,11 @@ def build_specfile(target, source, env):
""" Builds a RPM specfile from a dictionary with string metadata and
by analyzing a tree of nodes.
"""
- with open(target[0].get_abspath(), 'w') as file:
+ with open(target[0].get_abspath(), 'w') as ofp:
try:
- file.write(build_specfile_header(env))
- file.write(build_specfile_sections(env))
- file.write(build_specfile_filesection(env, source))
+ ofp.write(build_specfile_header(env))
+ ofp.write(build_specfile_sections(env))
+ ofp.write(build_specfile_filesection(env, source))
# call a user specified function
if 'CHANGE_SPECFILE' in env:
diff --git a/engine/SCons/Tool/packaging/src_tarbz2.py b/engine/SCons/Tool/packaging/src_tarbz2.py
index eea29cb..b628ccd 100644
--- a/engine/SCons/Tool/packaging/src_tarbz2.py
+++ b/engine/SCons/Tool/packaging/src_tarbz2.py
@@ -26,7 +26,7 @@ The tarbz2 SRC packager.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/packaging/src_tarbz2.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
+__revision__ = "src/engine/SCons/Tool/packaging/src_tarbz2.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
from SCons.Tool.packaging import putintopackageroot
diff --git a/engine/SCons/Tool/packaging/src_targz.py b/engine/SCons/Tool/packaging/src_targz.py
index 94ebea4..4c7469c 100644
--- a/engine/SCons/Tool/packaging/src_targz.py
+++ b/engine/SCons/Tool/packaging/src_targz.py
@@ -26,7 +26,7 @@ The targz SRC packager.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/packaging/src_targz.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
+__revision__ = "src/engine/SCons/Tool/packaging/src_targz.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
from SCons.Tool.packaging import putintopackageroot
diff --git a/engine/SCons/Tool/packaging/src_tarxz.py b/engine/SCons/Tool/packaging/src_tarxz.py
index 62db2e2..6688c46 100644
--- a/engine/SCons/Tool/packaging/src_tarxz.py
+++ b/engine/SCons/Tool/packaging/src_tarxz.py
@@ -26,7 +26,7 @@ The tarxz SRC packager.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/packaging/src_tarxz.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
+__revision__ = "src/engine/SCons/Tool/packaging/src_tarxz.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
from SCons.Tool.packaging import putintopackageroot
diff --git a/engine/SCons/Tool/packaging/src_zip.py b/engine/SCons/Tool/packaging/src_zip.py
index b1f63fb..d56f3aa 100644
--- a/engine/SCons/Tool/packaging/src_zip.py
+++ b/engine/SCons/Tool/packaging/src_zip.py
@@ -26,7 +26,7 @@ The zip SRC packager.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/packaging/src_zip.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
+__revision__ = "src/engine/SCons/Tool/packaging/src_zip.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
from SCons.Tool.packaging import putintopackageroot
diff --git a/engine/SCons/Tool/packaging/tarbz2.py b/engine/SCons/Tool/packaging/tarbz2.py
index 70e7ee4..e371f1b 100644
--- a/engine/SCons/Tool/packaging/tarbz2.py
+++ b/engine/SCons/Tool/packaging/tarbz2.py
@@ -26,7 +26,7 @@ The tarbz2 packager.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/packaging/tarbz2.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
+__revision__ = "src/engine/SCons/Tool/packaging/tarbz2.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot
diff --git a/engine/SCons/Tool/packaging/targz.py b/engine/SCons/Tool/packaging/targz.py
index fa8800d..121e4a4 100644
--- a/engine/SCons/Tool/packaging/targz.py
+++ b/engine/SCons/Tool/packaging/targz.py
@@ -26,7 +26,7 @@ The targz packager.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/packaging/targz.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
+__revision__ = "src/engine/SCons/Tool/packaging/targz.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot
diff --git a/engine/SCons/Tool/packaging/tarxz.py b/engine/SCons/Tool/packaging/tarxz.py
index bad495b..3ec9822 100644
--- a/engine/SCons/Tool/packaging/tarxz.py
+++ b/engine/SCons/Tool/packaging/tarxz.py
@@ -26,7 +26,7 @@ The tarxz packager.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/packaging/tarxz.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
+__revision__ = "src/engine/SCons/Tool/packaging/tarxz.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot
diff --git a/engine/SCons/Tool/packaging/zip.py b/engine/SCons/Tool/packaging/zip.py
index c5dd7cc..11ab3b5 100644
--- a/engine/SCons/Tool/packaging/zip.py
+++ b/engine/SCons/Tool/packaging/zip.py
@@ -26,7 +26,7 @@ The zip SRC packager.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/packaging/zip.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
+__revision__ = "src/engine/SCons/Tool/packaging/zip.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot