mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-02-08 06:08:21 +00:00
remove redundant calls to cavern in locations.py
This commit is contained in:
@@ -2270,8 +2270,47 @@ def FindAndLoadSurvex():
|
||||
svx_scan.depthinclude = 0
|
||||
fullpathtotop = str(Path(survexfileroot.path).parent / survexfileroot.path)
|
||||
|
||||
print(f" - RunSurvexIfNeeded cavern on '{fullpathtotop}'", file=sys.stderr)
|
||||
svx_scan.RunSurvexIfNeeded(fullpathtotop, fullpathtotop)
|
||||
# In fact we always want to run this, and the location stuff later needs the .pos file
|
||||
# so we should not be using the RunSurvexIfNeeded function.
|
||||
print(f" - Running cavern on '{fullpathtotop}'", file=sys.stderr)
|
||||
logpath = Path(fullpathtotop + ".log")
|
||||
|
||||
try:
|
||||
print(
|
||||
f" - Regenerating cavern .pos .log and .3d for '{fullpathtotop}'\n at '{logpath}'\n"
|
||||
)
|
||||
|
||||
outputdir = Path(str(f"{fullpathtotop}.svx")).parent
|
||||
sp = subprocess.run(
|
||||
[settings.CAVERN, "--log", "--pos", f"--output={outputdir}", f"{fullpathtotop}.svx"],
|
||||
capture_output=True,
|
||||
check=False,
|
||||
text=True,
|
||||
)
|
||||
|
||||
if sp.returncode != 0:
|
||||
message = f" ! Error when running {settings.CAVERN}: {fullpathtotop}"
|
||||
url = f"/survexfile{fullpathtotop}.svx".replace(str(settings.SURVEX_DATA), "")
|
||||
stash_data_issue(parser="survex", message=message, url=url)
|
||||
print(message)
|
||||
print(
|
||||
"stderr:\n\n" + str(sp.stderr) + "\n\n" + str(sp.stdout) + "\n\nreturn code: " + str(sp.returncode)
|
||||
)
|
||||
self.caverncount += 1
|
||||
|
||||
# should also collect all the .err files too and create a DataIssue for each one which
|
||||
# - is nonzero in size AND
|
||||
# - has Error greater than 5% anywhere, or some other more serious error
|
||||
|
||||
errpath = Path(fullpathtotop + ".err")
|
||||
if errpath.is_file():
|
||||
if errpath.stat().st_size == 0:
|
||||
errpath.unlink() # delete empty closure error file
|
||||
except:
|
||||
message = f' ! FAIL running cavern on survex file "{fullpathtotop}"'
|
||||
stash_data_issue(parser="survex", message=message)
|
||||
print(message)
|
||||
|
||||
svx_scan.uniquefile[str(survexfileroot)] = ["0"]
|
||||
|
||||
indent = ""
|
||||
|
||||
Reference in New Issue
Block a user