summaryrefslogtreecommitdiff
path: root/engine/SCons/Tool/packaging/__init__.py
diff options
context:
space:
mode:
authorLuca Falavigna <dktrkranz@debian.org>2010-06-15 09:21:32 +0000
committerLuca Falavigna <dktrkranz@debian.org>2010-06-15 09:21:32 +0000
commit07fc59e19636a4fc97a18b2038f3fe1c72a94000 (patch)
tree79d4a6239d81b2ccb4752d4f5ca25e0a7d3b4d4b /engine/SCons/Tool/packaging/__init__.py
parent7f642861f3946d4241cbd668de258293ba92767a (diff)
parent340d57481935334465037d97c0db1555b70c0eb1 (diff)
Merge commit 'upstream/2.0.0'
Diffstat (limited to 'engine/SCons/Tool/packaging/__init__.py')
-rw-r--r--engine/SCons/Tool/packaging/__init__.py32
1 files changed, 15 insertions, 17 deletions
diff --git a/engine/SCons/Tool/packaging/__init__.py b/engine/SCons/Tool/packaging/__init__.py
index 3ef610c..e7d684e 100644
--- a/engine/SCons/Tool/packaging/__init__.py
+++ b/engine/SCons/Tool/packaging/__init__.py
@@ -24,9 +24,8 @@ SCons Packaging Tool.
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# 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 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/packaging/__init__.py 5023 2010/06/14 22:05:46 scons"
import SCons.Environment
from SCons.Variables import *
@@ -58,7 +57,7 @@ def Tag(env, target, source, *more_tags, **kw_tags):
kw_tags[first_tag[0]] = ''
if len(kw_tags) == 0 and len(more_tags) == 0:
- raise UserError, "No tags given."
+ raise UserError("No tags given.")
# XXX: sanity checks
for x in more_tags:
@@ -91,7 +90,7 @@ def Package(env, target=None, source=None, **kw):
source = env.FindInstalledFiles()
if len(source)==0:
- raise UserError, "No source for Package() given"
+ raise UserError("No source for Package() given")
# decide which types of packages shall be built. Can be defined through
# four mechanisms: command line argument, keyword argument,
@@ -105,16 +104,16 @@ def Package(env, target=None, source=None, **kw):
kw['PACKAGETYPE'] = GetOption('package_type')
if kw['PACKAGETYPE'] == None:
- if env['BUILDERS'].has_key('Tar'):
+ if 'Tar' in env['BUILDERS']:
kw['PACKAGETYPE']='targz'
- elif env['BUILDERS'].has_key('Zip'):
+ elif 'Zip' in env['BUILDERS']:
kw['PACKAGETYPE']='zip'
else:
- raise UserError, "No type for Package() given"
+ raise UserError("No type for Package() given")
PACKAGETYPE=kw['PACKAGETYPE']
if not is_List(PACKAGETYPE):
- PACKAGETYPE=string.split(PACKAGETYPE, ',')
+ PACKAGETYPE=PACKAGETYPE.split(',')
# load the needed packagers.
def load_packager(type):
@@ -124,7 +123,7 @@ def Package(env, target=None, source=None, **kw):
except ImportError, e:
raise EnvironmentError("packager %s not available: %s"%(type,str(e)))
- packagers=map(load_packager, PACKAGETYPE)
+ packagers=list(map(load_packager, PACKAGETYPE))
# set up targets and the PACKAGEROOT
try:
@@ -139,7 +138,7 @@ def Package(env, target=None, source=None, **kw):
default_target = default_name%kw
target.extend( [default_target]*size_diff )
- if not kw.has_key('PACKAGEROOT'):
+ if 'PACKAGEROOT' not in kw:
kw['PACKAGEROOT'] = default_name%kw
except KeyError, e:
@@ -153,7 +152,7 @@ def Package(env, target=None, source=None, **kw):
try:
for packager in packagers:
t=[target.pop(0)]
- t=apply(packager.package, [env,t,source], kw)
+ t=packager.package(env,t,source, **kw)
targets.extend(t)
assert( len(target) == 0 )
@@ -173,8 +172,7 @@ def Package(env, target=None, source=None, **kw):
args.remove('target')
args.remove('source')
# now remove any args for which we have a value in kw.
- #args=[x for x in args if not kw.has_key(x)]
- args=filter(lambda x, kw=kw: not kw.has_key(x), args)
+ args=[x for x in args if x not in kw]
if len(args)==0:
raise # must be a different error, so reraise
@@ -222,7 +220,7 @@ def options(opts):
opts.AddVariables(
EnumVariable( 'PACKAGETYPE',
'the type of package to create.',
- None, allowed_values=map( str, __all__ ),
+ None, allowed_values=list(map( str, __all__ )),
ignorecase=2
)
)
@@ -236,8 +234,8 @@ def copy_attr(f1, f2):
"""
#pattrs = [x for x in dir(f1) if not hasattr(f2, x) and\
# x.startswith('PACKAGING_')]
- copyit = lambda x, f2=f2: not hasattr(f2, x) and x[:10] == 'PACKAGING_'
- pattrs = filter(copyit, dir(f1))
+ copyit = lambda x: not hasattr(f2, x) and x[:10] == 'PACKAGING_'
+ pattrs = list(filter(copyit, dir(f1)))
for attr in pattrs:
setattr(f2, attr, getattr(f1, attr))
def putintopackageroot(target, source, env, pkgroot, honor_install_location=1):
@@ -291,7 +289,7 @@ def stripinstallbuilder(target, source, env):
(file.builder.name=="InstallBuilder" or\
file.builder.name=="InstallAsBuilder"))
- if len(filter(has_no_install_location, source)):
+ if len(list(filter(has_no_install_location, source))):
warn(Warning, "there are files to package which have no\
InstallBuilder attached, this might lead to irreproducible packages")