Commit c9506fb8 authored by Marie Houillon's avatar Marie Houillon
Browse files

Add condition on bundle module loading

parent 5a63243a
Pipeline #2166 passed with stage
in 1 minute and 9 seconds
......@@ -60,4 +60,5 @@ from carputils.bundle.bundle import BundleModule
# This hack is 'officially' supported, as outlined in this message by Gudio van
# Rossum, the creator of Python:
# https://mail.python.org/pipermail/python-ideas/2012-May/014969.html
sys.modules[__name__] = BundleModule()
if hasattr(sys.modules['__main__'], '__file__'):
sys.modules[__name__] = BundleModule()
\ No newline at end of file
......@@ -100,11 +100,10 @@ def makevars(execs):
makevars.CIRCADAPT = 0
makevars.FSM = 0
makevars.WITH_PURK = 0
cmd = [str(execs.CARP), '-buildinfo']
try:
output = subprocess.check_output(cmd).decode('utf8').split('\n')
except subprocess.CalledProcessError:
warn('Error retrieving -buildinfo from openCARP - assuming no mechanics '
'or CUDA')
......
......@@ -24,7 +24,6 @@ def summary(config, execs, solver_opts, cli):
"""
Generate a summary report of the execs generated by cli.
"""
width = format.terminal_width()
EQUALS_LINE = '=' * width
DASH_LINE = '-' * width
......
......@@ -446,7 +446,6 @@ def carpexample(parser=standard_parser,
"""
@wraps(run)
def wrapped(argv=sys.argv[1:], job=None, outdir=None):
# Generate parser
prs = parser()
......@@ -488,7 +487,11 @@ def carpexample(parser=standard_parser,
# Create self-contained bundle
if settings.cli.bundle is not None:
bundle.create_bundle_folder()
if not hasattr(sys.modules['__main__'], '__file__'):
print("Your system configuration doesn't allow to use the --bundle option.")
sys.exit(0)
else:
bundle.create_bundle_folder()
# Generate job ID
if temp:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment