mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-25 08:50:30 +08:00
build: Remove Python 2 quirks
This commit is contained in:
@@ -27,8 +27,6 @@
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import pickle
|
||||
import os
|
||||
import re
|
||||
@@ -56,14 +54,6 @@ items = {}
|
||||
bsps = {}
|
||||
|
||||
|
||||
def no_unicode(value):
|
||||
if sys.version_info[0] > 2:
|
||||
return value
|
||||
if isinstance(value, unicode):
|
||||
return str(value)
|
||||
return value
|
||||
|
||||
|
||||
def get_repo_release_label(ctx):
|
||||
from waflib.Build import Context
|
||||
from waflib.Errors import WafError
|
||||
@@ -1040,7 +1030,6 @@ class OptionItem(Item):
|
||||
try:
|
||||
value = cic.cp.get(conf.variant, name)
|
||||
cic.add_option(name)
|
||||
value = no_unicode(value)
|
||||
except configparser.NoOptionError:
|
||||
value = self.default_value(conf.env.ENABLE)
|
||||
return value
|
||||
@@ -1268,13 +1257,9 @@ def load_items_in_directory(ctx, ctors, path):
|
||||
#
|
||||
# Do not use a system provided yaml module and instead import it from
|
||||
# the project. This reduces the host system requirements to a simple
|
||||
# Python 2.7 or 3 installation without extra modules.
|
||||
# Python 3 installation without extra modules.
|
||||
#
|
||||
if sys.version_info[0] == 2:
|
||||
yaml_path = "yaml/lib"
|
||||
else:
|
||||
yaml_path = "yaml/lib3"
|
||||
sys.path += [yaml_path]
|
||||
sys.path.append("yaml/lib3")
|
||||
from yaml import safe_load
|
||||
|
||||
load_from_yaml(safe_load, ctx, data_by_uid, path, path)
|
||||
@@ -1408,7 +1393,7 @@ def load_version(ctx):
|
||||
prefix = None
|
||||
if cp.read([version_file]):
|
||||
try:
|
||||
value = no_unicode(cp.get("version", "revision"))
|
||||
value = cp.get("version", "revision")
|
||||
# The revision is <major>.<minor>[-label]
|
||||
# break is up and update the version
|
||||
if "." not in value:
|
||||
@@ -1480,7 +1465,6 @@ def inherit(conf, cp, bsp_map, arch, bsp, path):
|
||||
try:
|
||||
base = cp.get(variant, "INHERIT")
|
||||
cp.remove_option(variant, "INHERIT")
|
||||
base = no_unicode(base)
|
||||
base_variant = arch + "/" + base
|
||||
conf.msg(
|
||||
"Inherit options from '{}'".format(base_variant),
|
||||
@@ -1508,7 +1492,6 @@ def inherit(conf, cp, bsp_map, arch, bsp, path):
|
||||
def resolve_option_inheritance(conf, cp):
|
||||
bsp_map = {}
|
||||
for variant in cp.sections():
|
||||
variant = no_unicode(variant)
|
||||
try:
|
||||
arch, bsp = variant.split("/")
|
||||
except:
|
||||
@@ -1529,7 +1512,6 @@ def get_compiler(conf, cp, variant):
|
||||
try:
|
||||
value = cp.get(variant, "COMPILER")
|
||||
cp.remove_option(variant, "COMPILER")
|
||||
value = no_unicode(value)
|
||||
check_compiler(conf, value)
|
||||
except configparser.NoOptionError:
|
||||
value = "gcc"
|
||||
@@ -1627,7 +1609,6 @@ def configure(conf):
|
||||
path_list = get_path_list(conf)
|
||||
variant_list = []
|
||||
for variant in cp.sections():
|
||||
variant = no_unicode(variant)
|
||||
variant_list.append(variant)
|
||||
configure_variant(conf, cp, bsp_map, path_list, top_group, variant)
|
||||
conf.setenv("")
|
||||
|
||||
Reference in New Issue
Block a user