Skip to content

Py3 fixes and Travis CI enablement #9521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jan 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,18 @@ matrix:
# Report success since we have overridden default behavior
- bash -c "$STATUS" success "Local $NAME testing has passed"

# - <<: *tools-pytest
# env: NAME=tools-py3.5
# python: 3.5
#
# - <<: *tools-pytest
# env: NAME=tools-py3.6
# python: 3.6
- <<: *tools-pytest
env: NAME=tools-py3.5
python: 3.5

- <<: *tools-pytest
env: NAME=tools-py3.6
python: 3.6

- <<: *tools-pytest
env: NAME=tools-py3.7
python: 3.7
dist: xenial

- env:
- NAME=astyle
Expand Down
2 changes: 1 addition & 1 deletion tools/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ def validate_config(self):
min = int(str(min), 0) if min is not None else None
max = int(str(max), 0) if max is not None else None

if (value < min or (value > max if max is not None else False)):
if (min is not None and value < min) or (max is not None and value > max):
err_msg += "\nInvalid config range for %s, is not in the required range: [%s:%s]"\
% (param,
min if min is not None else "-inf",
Expand Down
2 changes: 2 additions & 0 deletions tools/test/build_api/build_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def test_build_project_app_config(self, mock_prepare_toolchain, mock_exists, _,
lib_config_data=None,
)
mock_prepare_toolchain().config.deliver_into.return_value = (None, None)
mock_prepare_toolchain().config.name = None

build_project(self.src_paths, self.build_path, self.target,
self.toolchain_name, app_config=app_config, notify=notify)
Expand Down Expand Up @@ -175,6 +176,7 @@ def test_build_project_no_app_config(self, mock_prepare_toolchain, mock_exists,
lib_config_data=None,
)
mock_prepare_toolchain().config.deliver_into.return_value = (None, None)
mock_prepare_toolchain().config.name = None

build_project(self.src_paths, self.build_path, self.target,
self.toolchain_name, notify=notify)
Expand Down
3 changes: 2 additions & 1 deletion tools/test/pylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def execute_pylint(filename):
process = subprocess.Popen(
["pylint", filename],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
stderr=subprocess.PIPE,
universal_newlines=True
)
stout, sterr = process.communicate()
status = process.poll()
Expand Down
2 changes: 1 addition & 1 deletion tools/test/spm/test_generate_partition_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import pytest
from jinja2.defaults import DEFAULT_FILTERS

from test_data import *
from .test_data import *
from tools.spm.generate_partition_code import *

# Imported again as a module for monkey-patching
Expand Down
2 changes: 1 addition & 1 deletion tools/toolchains/arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def version_check(self):
stdout, _, retcode = run_cmd([self.cc[0], "--vsn"], redirect=True)
msg = None
min_ver, max_ver = self.ARMCC_RANGE
match = self.ARMCC_VERSION_RE.search(stdout)
match = self.ARMCC_VERSION_RE.search(stdout.encode("utf-8"))
found_version = LooseVersion(match.group(1).decode("utf-8")) if match else None
min_ver, max_ver = self.ARMCC_RANGE
if found_version and (found_version < min_ver or found_version >= max_ver):
Expand Down
2 changes: 1 addition & 1 deletion tools/toolchains/gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def __init__(self, target, notify=None, macros=None, build_profile=None,
def version_check(self):
stdout, _, retcode = run_cmd([self.cc[0], "--version"], redirect=True)
msg = None
match = self.GCC_VERSION_RE.search(stdout)
match = self.GCC_VERSION_RE.search(stdout.encode("utf-8"))
found_version = LooseVersion(match.group(0).decode('utf-8')) if match else None
min_ver, max_ver = self.GCC_RANGE
if found_version and (found_version < min_ver or found_version >= max_ver):
Expand Down
2 changes: 1 addition & 1 deletion tools/toolchains/iar.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def __init__(self, target, notify=None, macros=None, build_profile=None,
def version_check(self):
stdout, _, retcode = run_cmd([self.cc[0], "--version"], redirect=True)
msg = None
match = self.IAR_VERSION_RE.search(stdout)
match = self.IAR_VERSION_RE.search(stdout.encode("utf-8"))
found_version = match.group(1).decode("utf-8") if match else None
if found_version and LooseVersion(found_version) != self.IAR_VERSION:
msg = "Compiler version mismatch: Have {}; expected {}".format(
Expand Down
3 changes: 2 additions & 1 deletion tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ def run_cmd(command, work_dir=None, chroot=None, redirect=False):

try:
process = Popen(command, stdout=PIPE,
stderr=STDOUT if redirect else PIPE, cwd=work_dir)
stderr=STDOUT if redirect else PIPE, cwd=work_dir,
universal_newlines=True)
_stdout, _stderr = process.communicate()
except OSError:
print("[OS ERROR] Command: "+(' '.join(command)))
Expand Down