From a6e60c0bf7ac09175b556cabb8dd13d0d2d49a12 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Tue, 4 Oct 2022 00:00:55 +0300 Subject: [PATCH] working on loading all the non*inlcuded svx files --- parsers/survex.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/parsers/survex.py b/parsers/survex.py index 70afddf..d37fea7 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -1201,6 +1201,7 @@ class LoadingSurvex(): print("\n ", file=sys.stderr,end='') if path in self.svxfileslist: + # We have already used os.normpath() so this is OK. "/../" and "//" have been simplified already. message = f" * Warning. Duplicate detected. We have already seen this *include '{path}' from another survex file. Detected at callcount:{self.callcount} depth:{self.depthinclude}" print(message) print(message,file=flinear) @@ -1464,14 +1465,36 @@ def FindAndLoadSurvex(survexblockroot): flinear.write(" - {:,} survex files in linear include list \n".format(len(svxfileslist))) flinear.close() fcollate.close() + print("\n - {:,} runs of survex 'cavern' refreshing .3d files \n".format(svx_scan.caverncount),file=sys.stderr) + svx_scan = None # Hmm. Does this actually delete all the instance variables if they are lists, dicts etc.? print("\n - {:,} survex files in linear include list \n".format(len(svxfileslist)),file=sys.stderr) - - + mem1 = get_process_memory() print(" - MEM:{:7.2f} MB END ".format(mem0),file=sys.stderr) print(" - MEM:{:7.3f} MB USED".format(mem1-mem0),file=sys.stderr) + + a = [] + b=[] + + for p in Path(settings.SURVEX_DATA).rglob('*.svx'): + if p.is_file(): + po = p.relative_to(Path(settings.SURVEX_DATA)) + pox = po.with_suffix('') + if str(pox) not in svxfileslist: + print(f"[{pox}]", file=sys.stderr) + a.append(pox) + else: + print("'", end=" ", file=sys.stderr) + b.append(pox) + + print("=>", len(a), len(b), len(svxfileslist), file=sys.stderr) + + for i in [0,1,2,3,4,5]: + print(f"==> [{svxfileslist[i]}]", file=sys.stderr) + + svxfileslist = [] # free memory # Before doing this, it would be good to identify the *equate and *entrance we need that are relevant to the