summaryrefslogtreecommitdiff
path: root/bitbake/lib
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-04-12 08:14:11 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2010-07-02 15:41:33 +0100
commit22a21799059b156d8858cbf32acb7c2aefb9a23b (patch)
tree1e0e83c86fe04e30576ddfb34577940596f8d809 /bitbake/lib
parent1180bab54e2879401f3586c91a48174191a1ee8b (diff)
downloadopenembedded-core-22a21799059b156d8858cbf32acb7c2aefb9a23b.tar.gz
openembedded-core-22a21799059b156d8858cbf32acb7c2aefb9a23b.tar.bz2
openembedded-core-22a21799059b156d8858cbf32acb7c2aefb9a23b.tar.xz
openembedded-core-22a21799059b156d8858cbf32acb7c2aefb9a23b.zip
Kill unnecessary usages of the types module
types.IntType -> int types.StringType -> basestring ... Also moves our ImmutableTypes tuple into our own namespace. (Bitbake rev: 83674a3a5564ecb1f9d2c9b2d5b1eeb3c31272ab) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/COW.py23
-rw-r--r--bitbake/lib/bb/data.py4
-rw-r--r--bitbake/lib/bb/data_smart.py8
-rw-r--r--bitbake/lib/bb/fetch/__init__.py3
-rw-r--r--bitbake/lib/bb/utils.py6
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