Public Access
cmdline interface fixed and properly added to deb package
This commit is contained in:
@@ -2,5 +2,6 @@ include src/damaris/gui/DAMARIS3.png
|
||||
include src/damaris/gui/DAMARIS3.ico
|
||||
include src/damaris/gui/damaris3.glade
|
||||
include src/damaris/gui/python.xml
|
||||
include scripts/damaris-cli
|
||||
#recursive-include doc/reference-html *.html *.gif *.png *.css
|
||||
#recursive-include doc/tutorial-html *.html *.gif *.png *.css *.tar.gz *.sh
|
||||
|
||||
Vendored
+1
@@ -2,3 +2,4 @@ doc/ usr/share/doc/python3-damaris/
|
||||
debian/damaris3.desktop usr/share/applications/
|
||||
src/damaris/gui/DAMARIS3.png usr/share/pixmaps/
|
||||
src/damaris/gui/DAMARIS3.ico usr/share/pixmaps/
|
||||
scripts/damaris-cli usr/bin/
|
||||
|
||||
Regular → Executable
+30
-17
@@ -1,9 +1,10 @@
|
||||
#! /usr/bin/env python
|
||||
#! /usr/bin/env python3
|
||||
|
||||
import time
|
||||
import sys
|
||||
import os
|
||||
import os.path
|
||||
import argparse
|
||||
import logging
|
||||
import tables
|
||||
import damaris.data.DataPool as DataPool
|
||||
@@ -13,7 +14,7 @@ import damaris.gui.BackendDriver as BackendDriver
|
||||
import damaris.gui.ResultHandling as ResultHandling
|
||||
import damaris.gui.ExperimentHandling as ExperimentHandling
|
||||
|
||||
logger = logging.getLogger("damaris.script_interface")
|
||||
logger = logging.getLogger("damaris.cli")
|
||||
|
||||
def progressbar(event):
|
||||
if event.subject=="__recentexperiment" or event.subject=="__recentresult":
|
||||
@@ -132,21 +133,33 @@ class ScriptInterface:
|
||||
|
||||
|
||||
if __name__=="__main__":
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Run DAMARIS experiment and result scripts."
|
||||
)
|
||||
parser.add_argument("experiment_script", help="Path to the experiment script file")
|
||||
parser.add_argument("result_script", help="Path to the result script file")
|
||||
parser.add_argument(
|
||||
"spool_dir", nargs="?", default=None,
|
||||
help="Spool directory (defaults to current working directory)"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--backend", default="/usr/lib/damaris/backends/Mobilecore",
|
||||
help="Path to the backend executable"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--output", default="data_pool.h5",
|
||||
help="Output HDF5 file path (default: data_pool.h5)"
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
if len(sys.argv)==1:
|
||||
logger.error("%s: data_handling_script [spool directory]", sys.argv[0])
|
||||
sys.exit(1)
|
||||
if len(sys.argv)==3:
|
||||
spool_dir=os.getcwd()
|
||||
else:
|
||||
spool_dir=sys.argv[3]
|
||||
|
||||
expscriptfile=open(sys.argv[1])
|
||||
expscript=expscriptfile.read()
|
||||
resscriptfile=open(sys.argv[2])
|
||||
resscript=resscriptfile.read()
|
||||
spool_dir = args.spool_dir if args.spool_dir else os.getcwd()
|
||||
|
||||
si=ScriptInterface(expscript, resscript,"/usr/lib/damaris/backends/Mobilecore", spool_dir)
|
||||
with open(args.experiment_script) as f:
|
||||
expscript = f.read()
|
||||
with open(args.result_script) as f:
|
||||
resscript = f.read()
|
||||
|
||||
si = ScriptInterface(expscript, resscript, args.backend, spool_dir)
|
||||
|
||||
si.data.register_listener(progressbar)
|
||||
|
||||
@@ -154,6 +167,6 @@ if __name__=="__main__":
|
||||
|
||||
si.waitForScriptsEnding()
|
||||
|
||||
si.dump_data("data_pool.h5")
|
||||
si.dump_data(args.output)
|
||||
|
||||
si=None
|
||||
si = None
|
||||
Reference in New Issue
Block a user