Skip to content

Commit f4aaca3

Browse files
committed
Removed F-strings from the build tools to maintain Python 3.2 compatability with upstream toolchains. Added new functionality for --status
1 parent 3b2af11 commit f4aaca3

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

build.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
parser.add_option('-d', '--dev', dest='dev', action="store_true", help='enable developer mode (does not use target-locked.json)', default=False)
4747
parser.add_option('-g', '--generate-docs', dest='generate_docs', action="store_true", help='generate documentation for the current target', default=False)
4848
parser.add_option('-j', '--parallelism', dest='parallelism', action="store", help='Set the number of parallel threads to build with, if supported', default=10)
49+
parser.add_option('-n', '--lines', dest='detail_lines', action="store", help="Sets the number of detail lines to output (only relevant to --status)", default=3 )
4950

5051
(options, args) = parser.parse_args()
5152

@@ -61,7 +62,7 @@
6162
exit(0)
6263

6364
if options.status:
64-
status()
65+
status(logLines=options.detail_lines, detail=options.verbose, libs=args)
6566
exit(0)
6667

6768
if options.revision:

utils/python/codal_utils.py

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ def build(clean, verbose = False, parallelism = 10):
2525

2626
# build
2727
if verbose:
28-
system(f"ninja -j {parallelism} --verbose")
28+
system("ninja -j {} --verbose".format(parallelism))
2929
else:
30-
system(f"ninja -j {parallelism}")
30+
system("ninja -j {}".format(parallelism))
3131
else:
3232
# configure
3333
system("cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -G \"Unix Makefiles\"")
@@ -37,9 +37,9 @@ def build(clean, verbose = False, parallelism = 10):
3737

3838
# build
3939
if verbose:
40-
system(f"make -j {parallelism} VERBOSE=1")
40+
system("make -j {} VERBOSE=1".format(parallelism))
4141
else:
42-
system(f"make -j {parallelism}")
42+
system("make -j {}".format(parallelism))
4343

4444
def read_json(fn):
4545
json_file = ""
@@ -81,7 +81,7 @@ def revision(rev):
8181
os.chdir(dirname)
8282
update(True)
8383

84-
def printstatus( logLines = 3 ):
84+
def printstatus( logLines = 3, detail = False ):
8585
print("\n***%s" % os.getcwd())
8686
branch = str(subprocess.check_output( [ "git", "branch", "--show-current"] ), "utf8").strip()
8787
hash = str(subprocess.check_output( [ "git", "rev-parse", "HEAD" ] ), "utf8").strip()
@@ -91,24 +91,31 @@ def printstatus( logLines = 3 ):
9191
except subprocess.CalledProcessError as e:
9292
tag = "~none~"
9393

94-
print( f"Branch: {branch}, Nearest Tag: {tag} ({hash})" )
95-
system( f"git --no-pager log -n {logLines} --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" )
96-
#system(f"git --no-pager log -n {logLines} --pretty=oneline")
97-
print( "" )
94+
print( "Branch: {branch}, Nearest Tag: {tag} ({hash})".format(branch=branch, tag=tag, hash=hash) )
95+
if detail:
96+
system( "git --no-pager log -n {} --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit".format(logLines) )
97+
print( "" )
98+
9899
system("git status -sb")
99100
print( "" )
100101

101102

102-
def status( logLines = 3 ):
103+
def status( logLines = 3, detail = True, libs = [] ):
103104
(codal, targetdir, target) = read_config()
104105
dirname = os.getcwd()
105-
for ln in target['libraries']:
106-
os.chdir(dirname + "/libraries/" + ln['name'])
107-
printstatus( logLines )
108-
os.chdir(dirname + "/libraries/" + targetdir)
109-
printstatus( logLines )
110-
os.chdir(dirname)
111-
printstatus( logLines )
106+
107+
if len(libs) == 0:
108+
for ln in target['libraries']:
109+
os.chdir(dirname + "/libraries/" + ln['name'])
110+
printstatus( logLines, detail )
111+
os.chdir(dirname + "/libraries/" + targetdir)
112+
printstatus( logLines, detail )
113+
os.chdir(dirname)
114+
printstatus( logLines, detail )
115+
else:
116+
for lib in libs:
117+
os.chdir(dirname + "/libraries/" + lib)
118+
printstatus( logLines, detail )
112119

113120
def get_next_version(options):
114121
if options.version:

0 commit comments

Comments
 (0)