diff options
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/COW.py | 23 | ||||
-rw-r--r-- | bitbake/lib/bb/data.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 8 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/__init__.py | 3 | ||||
-rw-r--r-- | bitbake/lib/bb/utils.py | 6 |
5 files changed, 22 insertions, 22 deletions
diff --git a/bitbake/lib/bb/COW.py b/bitbake/lib/bb/COW.py index ccb7cde3b..23a2cae2b 100644 --- a/bitbake/lib/bb/COW.py +++ b/bitbake/lib/bb/COW.py @@ -26,16 +26,17 @@ from __future__ import print_function import copy import types -types.ImmutableTypes = tuple([ \ - types.BooleanType, \ - types.ComplexType, \ - types.FloatType, \ - types.IntType, \ - types.LongType, \ - types.NoneType, \ - types.TupleType, \ - frozenset] + \ - list(types.StringTypes)) +ImmutableTypes = ( + types.NoneType, + bool, + complex, + float, + int, + long, + tuple, + frozenset, + basestring +) MUTABLE = "__mutable__" @@ -60,7 +61,7 @@ class COWDictMeta(COWMeta): __call__ = cow def __setitem__(cls, key, value): - if not isinstance(value, types.ImmutableTypes): + if not isinstance(value, ImmutableTypes): if not isinstance(value, COWMeta): cls.__hasmutable__ = True key += MUTABLE diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py index e401c5342..ba496c9d9 100644 --- a/bitbake/lib/bb/data.py +++ b/bitbake/lib/bb/data.py @@ -37,7 +37,7 @@ the speed is more critical here. # #Based on functions from the base bb module, Copyright 2003 Holger Schurig -import sys, os, re, types +import sys, os, re if sys.argv[0][-5:] == "pydoc": path = os.path.dirname(os.path.dirname(sys.argv[1])) else: @@ -193,7 +193,7 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False): if all: o.write('# %s=%s\n' % (var, oval)) - if not isinstance(val, types.StringType): + if not isinstance(val, basestring): return 0 if (var.find("-") != -1 or var.find(".") != -1 or var.find('{') != -1 or var.find('}') != -1 or var.find('+') != -1) and not all: diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 1704ed631..9436023b3 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py @@ -28,7 +28,7 @@ BitBake build tools. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Based on functions from the base bb module, Copyright 2003 Holger Schurig -import copy, re, sys, types +import copy, re, sys import bb from bb import utils from bb.COW import COWDictBase @@ -66,10 +66,10 @@ class DataSmart: code = match.group()[3:-1] codeobj = compile(code.strip(), varname or "<expansion>", "eval") s = utils.better_eval(codeobj, {"d": self}) - if isinstance(s, types.IntType): s = str(s) + if isinstance(s, int): s = str(s) return s - if not isinstance(s, types.StringType): # sanity check + if not isinstance(s, basestring): # sanity check return s if varname and varname in self.expand_cache: @@ -81,7 +81,7 @@ class DataSmart: s = __expand_var_regexp__.sub(var_sub, s) s = __expand_python_regexp__.sub(python_sub, s) if s == olds: break - if not isinstance(s, types.StringType): # sanity check + if not isinstance(s, basestring): # sanity check bb.msg.error(bb.msg.domain.Data, 'expansion of %s returned non-string %s' % (olds, s)) except KeyboardInterrupt: raise diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index fec9c6ed7..f52b0acfc 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py @@ -126,8 +126,7 @@ def uri_replace(uri, uri_find, uri_replace, d): for i in uri_find_decoded: loc = uri_find_decoded.index(i) result_decoded[loc] = uri_decoded[loc] - import types - if type(i) == types.StringType: + if isinstance(i, basestring): if (re.match(i, uri_decoded[loc])): result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc]) if uri_find_decoded.index(i) == 2: diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 02668b16c..a7fb44d7d 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -19,7 +19,7 @@ BitBake Utility Functions # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -import re, fcntl, os, types, string, stat, shutil, time +import re, fcntl, os, string, stat, shutil, time import sys import bb import errno @@ -72,9 +72,9 @@ def vercmp_part(a, b): if ca == None and cb == None: return 0 - if isinstance(ca, types.StringType): + if isinstance(ca, basestring): sa = ca in separators - if isinstance(cb, types.StringType): + if isinstance(cb, basestring): sb = cb in separators if sa and not sb: return -1 |