New: normal arg parsing
This commit is contained in:
parent
4f528318da
commit
2a8742cfc2
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
#from anisotropy import Anisotropy
|
20
anisotropy/__main__.py
Normal file
20
anisotropy/__main__.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import click
|
||||||
|
from anisotropy.anisotropy import Anisotropy
|
||||||
|
|
||||||
|
pass_anisotropy = click.make_pass_decorator(Anisotropy)
|
||||||
|
|
||||||
|
@click.group()
|
||||||
|
@click.version_option(version = "", message = Anisotropy.version())
|
||||||
|
@click.pass_context
|
||||||
|
def anisotropy(ctx):
|
||||||
|
ctx.obj = Anisotropy()
|
||||||
|
|
||||||
|
|
||||||
|
@anisotropy.command()
|
||||||
|
@click.option("-s", "--stage", "stage", type = click.Choice(["all", "mesh", "flow"]), default = "all")
|
||||||
|
@click.option("-p", "--param", "params", metavar = "key=value", multiple = True)
|
||||||
|
@pass_anisotropy
|
||||||
|
def compute(anisotropy, stage, params):
|
||||||
|
pass
|
||||||
|
|
||||||
|
anisotropy()
|
@ -6,10 +6,11 @@ import shutil
|
|||||||
ROOT = "/".join(__file__.split("/")[:-2])
|
ROOT = "/".join(__file__.split("/")[:-2])
|
||||||
sys.path.append(os.path.abspath(ROOT))
|
sys.path.append(os.path.abspath(ROOT))
|
||||||
|
|
||||||
from utils import struct
|
from anisotropy.utils import struct
|
||||||
import toml
|
import toml
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
__version__ = "1.1"
|
||||||
###
|
###
|
||||||
# Shell args
|
# Shell args
|
||||||
##
|
##
|
||||||
@ -50,6 +51,38 @@ logging.basicConfig(
|
|||||||
)
|
)
|
||||||
logger = logging.getLogger(config.logger.name)
|
logger = logging.getLogger(config.logger.name)
|
||||||
|
|
||||||
|
|
||||||
|
class Anisotropy(object):
|
||||||
|
def __init__(self):
|
||||||
|
#self.db = self.setupDB()
|
||||||
|
pass
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def version():
|
||||||
|
versions = {
|
||||||
|
"anisotropy": __version__,
|
||||||
|
"Python": sys.version.split(" ")[0],
|
||||||
|
"Salome": "[missed]",
|
||||||
|
"OpenFOAM": "[missed]"
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
salomeplVersion = salomeVersion()
|
||||||
|
openfoamVersion = openfoam.foamVersion()
|
||||||
|
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return "\n".join([ f"{ k }: { v }" for k, v in versions.items() ])
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def setupDB():
|
||||||
|
db.init(env["db_path"])
|
||||||
|
|
||||||
|
if not os.path.exists(env["db_path"]):
|
||||||
|
db.create_tables([Structures, Mesh])
|
||||||
|
|
||||||
|
return db
|
||||||
###
|
###
|
||||||
# Main
|
# Main
|
||||||
##
|
##
|
||||||
|
Loading…
Reference in New Issue
Block a user