diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2022-03-06 01:29:45 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2022-03-06 01:29:45 +0000 |
commit | 3ac617431f41c9bb85636c68d1aef72feb3944ff (patch) | |
tree | 094215a52b0cc85bfc7614a8fe23ce3f5beeaad3 /core/models | |
parent | 7a58aac08eb0b19b05f84955d855d8af6bb369de (diff) | |
download | troggle-3ac617431f41c9bb85636c68d1aef72feb3944ff.tar.gz troggle-3ac617431f41c9bb85636c68d1aef72feb3944ff.tar.bz2 troggle-3ac617431f41c9bb85636c68d1aef72feb3944ff.zip |
Make .3d files in same dir as .svx
Diffstat (limited to 'core/models')
-rw-r--r-- | core/models/caves.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/core/models/caves.py b/core/models/caves.py index 0a4cc3e..41a1b47 100644 --- a/core/models/caves.py +++ b/core/models/caves.py @@ -3,7 +3,8 @@ import os import datetime import re import json -from subprocess import call +import subprocess + from collections import defaultdict from pathlib import Path @@ -56,8 +57,15 @@ def writetrogglefile(filepath, filecontent): f.write(filecontent) #os.chmod(filepath, 0o664) # set file permissions to rw-rw-r-- # should replace .call with .run and capture_output=True - call([git, "add", filename], cwd=cwd) - call([git, "commit", "-m", f'Troggle online: cave or entrance edit -{filename}'], cwd=cwd) + sp = subprocess.run([git, "add", filename], cwd=cwd, capture_output=True, check=True, text=True) + if sp.returncode != 0: + print(f'git ADD {cwd}:\n\n' + str(sp.stderr) + '\n\n' + str(sp.stdout) + '\n\nreturn code: ' + str(sp.returncode)) + + sp = subprocess.run([git, "commit", "-m", f'Troggle online: cave or entrance edit -{filename}'], cwd=cwd, capture_output=True, check=True, text=True) + if sp.returncode != 0: + print(f'git COMMIT {cwd}:\n\n' + str(sp.stderr) + '\n\n' + str(sp.stdout) + '\n\nreturn code: ' + str(sp.returncode)) + # not catching and re-raising any exceptions yet, inc. the stderr etc.,. We should do that. + class Area(TroggleModel): |