mirror of
https://github.com/DJSundog/NopSCADlib.git
synced 2024-11-27 01:03:51 -05:00
Times for parts that no longer exist pruned from build times.
Now shows changes to the total time.
This commit is contained in:
parent
4cb324ed37
commit
cb30f0c63d
@ -72,10 +72,11 @@ def make_parts(target, part_type, parts = None):
|
||||
#
|
||||
# Decide which files to make
|
||||
#
|
||||
all_parts = bom_to_parts(bom_dir, part_type)
|
||||
if parts:
|
||||
targets = list(parts) #copy the list so we dont modify the list passed in
|
||||
else:
|
||||
targets = bom_to_parts(bom_dir, part_type)
|
||||
targets = list(all_parts)
|
||||
for file in os.listdir(target_dir):
|
||||
if file.endswith('.' + part_type):
|
||||
if not file in targets:
|
||||
@ -150,4 +151,4 @@ def make_parts(target, part_type, parts = None):
|
||||
for part in targets:
|
||||
print("Could not find a module called", part[:-4] + module_suffix, "to make", part)
|
||||
usage(part_type)
|
||||
times.print_times()
|
||||
times.print_times(all_parts)
|
||||
|
@ -52,23 +52,34 @@ def add_time(name, start):
|
||||
del times[name.lower()]
|
||||
times[name] = round(time.time() - start, 3)
|
||||
|
||||
def print_times():
|
||||
write_times()
|
||||
def print_times(files = None):
|
||||
sorted_times = sorted(times.items(), key=lambda kv: kv[1])
|
||||
total = 0
|
||||
old_total = 0
|
||||
for entry in sorted_times:
|
||||
colour = Fore.WHITE
|
||||
key = entry[0]
|
||||
if files and not key in files:
|
||||
del times[key]
|
||||
else:
|
||||
new = entry[1]
|
||||
delta = 0
|
||||
colour = Fore.WHITE
|
||||
if key in last_times:
|
||||
old = last_times[key]
|
||||
old_total += old
|
||||
delta = new - old
|
||||
if delta > 0.3:
|
||||
colour = Fore.RED
|
||||
if delta < -0.3:
|
||||
colour = Fore.GREEN
|
||||
print(colour + "%5.1f %5.1f %s" % (new, delta, key))
|
||||
print(colour + "%6.1f %5.1f %s" % (new, delta, key))
|
||||
total += new
|
||||
write_times()
|
||||
if sorted_times:
|
||||
print(Fore.WHITE + "%5.1f" % total)
|
||||
colour = Fore.WHITE
|
||||
delta = total - old_total
|
||||
if delta > 1:
|
||||
colour = Fore.RED
|
||||
if delta < -1:
|
||||
colour = Fore.GREEN
|
||||
print(colour + "%6.1f %5.1f TOTAL%s" % (total, delta, Fore.WHITE))
|
||||
|
@ -159,6 +159,7 @@ def views(target, do_assemblies = None):
|
||||
# Find all the scad files
|
||||
#
|
||||
main_blurb = None
|
||||
pngs = []
|
||||
for dir in source_dirs(bom_dir):
|
||||
if os.path.isdir(dir):
|
||||
for filename in os.listdir(dir):
|
||||
@ -185,15 +186,21 @@ def views(target, do_assemblies = None):
|
||||
if not "blurb" in ass:
|
||||
ass["blurb"] = blurb.scrape_module_blurb(lines[:line_no])
|
||||
break
|
||||
if not do_assemblies or real_name in do_assemblies:
|
||||
|
||||
#
|
||||
# Run openscad on the created file
|
||||
#
|
||||
dname = deps_name(deps_dir, filename)
|
||||
for explode in [0, 1]:
|
||||
#
|
||||
# Generate png name
|
||||
#
|
||||
png_name = target_dir + '/' + real_name + '.png'
|
||||
if not explode:
|
||||
png_name = png_name.replace('_assembly', '_assembled')
|
||||
pngs.append(png_name)
|
||||
|
||||
if not do_assemblies or real_name in do_assemblies:
|
||||
changed = check_deps(png_name, dname)
|
||||
changed = times.check_have_time(changed, png_name)
|
||||
changed = options.have_changed(changed, png_name)
|
||||
@ -403,16 +410,16 @@ def views(target, do_assemblies = None):
|
||||
#
|
||||
# Convert to HTML
|
||||
#
|
||||
html_name = 'readme.html'
|
||||
html_name = top_dir + 'readme.html'
|
||||
t = time.time()
|
||||
with open(top_dir + html_name, "wt") as html_file:
|
||||
with open(html_name, "wt") as html_file:
|
||||
do_cmd(("python -m markdown -x tables -x sane_lists " + doc_name).split(), html_file)
|
||||
times.add_time(top_dir + html_name, t)
|
||||
times.print_times()
|
||||
times.add_time(html_name, t)
|
||||
times.print_times(pngs + [html_name])
|
||||
#
|
||||
# Make the printme.html by replacing empty spans that invisbly mark the page breaks by page break divs.
|
||||
#
|
||||
with open(top_dir + 'readme.html', 'rt') as src:
|
||||
with open(html_name, 'rt') as src:
|
||||
lines = src.readlines()
|
||||
|
||||
i = 0
|
||||
|
Loading…
Reference in New Issue
Block a user