Skip to content

Commit

Permalink
Improve error messages from "inv qrc"
Browse files Browse the repository at this point in the history
ASIM-5273
  • Loading branch information
prusse-martin committed Nov 1, 2023
1 parent 03d7b91 commit 6eedfd2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ target/
# PyCharm files
.idea/

# Underling mxgraph library that could have been cloned.
/mxgraph/

# Generate Qt resource files
resource_*.qrc
resource_*.py
Expand Down
22 changes: 20 additions & 2 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,29 @@ def create_web_resource(resource_name, src_dir):
print_message('{}* generated {}'.format(indent * 2, py_file))

mxgraph = os.environ.get('MXGRAPHPATH', None)
if mxgraph is None:
if mxgraph is not None:
if not os.path.isdir(mxgraph):
raise IOError(
"Unable to determine MxGraph to use:"
" directory obtained from `MXGRAPHPATH` env var does not exist"
)

else:
env_dir = deploy.get_conda_env_path()
if env_dir is None:
raise IOError("Unable to determine MxGraph mxgraph in " "environment")
raise IOError(
"Unable to determine MxGraph to use:"
" no `MXGRAPHPATH` env var defined"
" and no conda environment active"
)

mxgraph = '{env_dir}/mxgraph'.format(env_dir=env_dir)
if not os.path.isdir(mxgraph):
raise IOError(
"Unable to determine MxGraph to use:"
" no `MXGRAPHPATH` env var defined"
" and not located in active conda environment"
)

create_web_resource(
resource_name='mxgraph', src_dir='{folder}/javascript/src'.format(folder=mxgraph)
Expand Down

0 comments on commit 6eedfd2

Please sign in to comment.