1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-05 15:00:33 +00:00

Import python six module only if python is 2.7

This commit is contained in:
Carles Fernandez 2020-05-10 18:15:09 +02:00
parent 0637365d6c
commit a7928bf14c
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 14 additions and 9 deletions

View File

@ -10,9 +10,10 @@
# #
from __future__ import print_function from __future__ import print_function
import sys
import six if sys.version_info[0] < 3:
import six
archs = list() archs = list()
arch_dict = dict() arch_dict = dict()
@ -75,8 +76,9 @@ for arch_xml in archs_xml:
name = flag_xml.attributes["compiler"].value name = flag_xml.attributes["compiler"].value
if name not in flags: flags[name] = list() if name not in flags: flags[name] = list()
flags[name].append(flag_xml.firstChild.data) flags[name].append(flag_xml.firstChild.data)
#force kwargs keys to be of type str, not unicode for py25 if sys.version_info[0] < 3:
kwargs = dict((str(k), v) for k, v in six.iteritems(kwargs)) #force kwargs keys to be of type str, not unicode for py25
kwargs = dict((str(k), v) for k, v in six.iteritems(kwargs))
register_arch(flags=flags, checks=checks, **kwargs) register_arch(flags=flags, checks=checks, **kwargs)
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -8,9 +8,11 @@
# #
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
# #
from __future__ import print_function
import six from __future__ import print_function
import sys
if sys.version_info[0] < 3:
import six
from volk_gnsssdr_arch_defs import arch_dict from volk_gnsssdr_arch_defs import arch_dict
@ -28,7 +30,7 @@ class machine_class(object):
self.archs.append(arch) self.archs.append(arch)
self.arch_names.append(arch_name) self.arch_names.append(arch_name)
self.alignment = max([a.alignment for a in self.archs]) self.alignment = max([a.alignment for a in self.archs])
def __repr__(self): return self.name def __repr__(self): return self.name
def register_machine(name, archs): def register_machine(name, archs):
@ -64,7 +66,8 @@ for machine_xml in machines_xml:
except: pass except: pass
kwargs['archs'] = kwargs['archs'].split() kwargs['archs'] = kwargs['archs'].split()
#force kwargs keys to be of type str, not unicode for py25 #force kwargs keys to be of type str, not unicode for py25
kwargs = dict((str(k), v) for k, v in six.iteritems(kwargs)) if sys.version_info[0] < 3:
kwargs = dict((str(k), v) for k, v in six.iteritems(kwargs))
register_machine(**kwargs) register_machine(**kwargs)
if __name__ == '__main__': if __name__ == '__main__':