Skip to content

Commit 7d31512

Browse files
authored
Merge pull request #3171 from bridadan/fix_exporter_supported
[tools] Fixing project.py -S printing problem
2 parents 35dbb3f + b14a970 commit 7d31512

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ script:
77
- python tools/test/pylint.py
88
- py.test tools/test/toolchains/api.py
99
- python tools/test/memap/memap_test.py
10+
- python tools/project.py -S
1011
- python tools/build_travis.py
1112
before_install:
1213
- sudo add-apt-repository -y ppa:terry.guo/gcc-arm-embedded
@@ -16,9 +17,7 @@ before_install:
1617
- arm-none-eabi-gcc --version
1718
- python --version
1819
install:
19-
- sudo pip install colorama
20-
- sudo pip install prettytable
21-
- sudo pip install jinja2
20+
- sudo pip install -r requirements.txt
2221
- sudo pip install pytest
2322
- sudo pip install pylint
2423
- sudo pip install hypothesis

tools/project.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from tools.utils import argparse_filestring_type, argparse_many, args_error
1919
from tools.utils import argparse_force_lowercase_type
2020
from tools.utils import argparse_force_uppercase_type
21+
from tools.utils import print_large_string
2122
from tools.project_api import export_project, get_exporter_toolchain
2223
from tools.options import extract_profile
2324

@@ -189,7 +190,7 @@ def main():
189190

190191
# Only prints matrix of supported IDEs
191192
if options.supported_ides:
192-
print mcu_ide_matrix()
193+
print_large_string(mcu_ide_matrix())
193194
exit(0)
194195

195196
# Only prints matrix of supported IDEs

tools/utils.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from os.path import isdir, join, exists, split, relpath, splitext, abspath
2525
from os.path import commonprefix, normpath, dirname
2626
from subprocess import Popen, PIPE, STDOUT, call
27+
from math import ceil
2728
import json
2829
from collections import OrderedDict
2930
import logging
@@ -486,3 +487,23 @@ def parse_type(not_parent):
486487
else:
487488
return not_parent
488489
return parse_type
490+
491+
def print_large_string(large_string):
492+
""" Breaks a string up into smaller pieces before print them
493+
494+
This is a limitation within Windows, as detailed here:
495+
https://bugs.python.org/issue11395
496+
497+
Positional arguments:
498+
large_string - the large string to print
499+
"""
500+
string_limit = 1000
501+
large_string_len = len(large_string)
502+
num_parts = int(ceil(float(large_string_len) / float(string_limit)))
503+
for string_part in range(num_parts):
504+
start_index = string_part * string_limit
505+
if string_part == num_parts - 1:
506+
print large_string[start_index:]
507+
else:
508+
end_index = ((string_part + 1) * string_limit) - 1
509+
print large_string[start_index:end_index],

0 commit comments

Comments
 (0)