diff options
author | Stephen Clark <stephen.clark@oarcorp.com> | 2020-09-23 16:00:55 -0500 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2020-09-26 11:01:04 +1000 |
commit | ed5030bc24dbfdfac52074ed78cf4231bf1f353d (patch) | |
tree | 82a0d85b8496837278a37d1de8b327cce5dc6c0f /source-builder/sb | |
parent | patch gcc i386 multiarch (diff) | |
download | rtems-source-builder-ed5030bc24dbfdfac52074ed78cf4231bf1f353d.tar.bz2 |
pkgconfig.py: Removed use of "unicode" keyword for python3 compatibility
Closes #4094.
Diffstat (limited to 'source-builder/sb')
-rwxr-xr-x | source-builder/sb/pkgconfig.py | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/source-builder/sb/pkgconfig.py b/source-builder/sb/pkgconfig.py index 89b4d5c..198ec80 100755 --- a/source-builder/sb/pkgconfig.py +++ b/source-builder/sb/pkgconfig.py @@ -103,6 +103,22 @@ class package(object): dst.nodes = copy.copy(src.nodes) @staticmethod + def _is_string(us): + if type(us) == str: + return True + try: + if type(us) == unicode: + return True + except: + pass + try: + if type(us) == bytes: + return True + except: + pass + return False + + @staticmethod def is_version(v): for n in v.split('.'): if not n.isdigit(): @@ -214,12 +230,7 @@ class package(object): prefix = default_prefix() if prefix: self._log('prefix: %s' % (prefix)) - try: - if type(prefix) is unicode: - prefix = prefix.decode("utf-8", "ignore") - except: - pass - if type(prefix) is str: + if self._is_string(prefix): prefix = str(prefix) self.prefix = [] for p in prefix.split(os.pathsep): |