Skip to content

Sourcing env.sh multiple times #24

@mmunoz-gmv

Description

@mmunoz-gmv

The variables generated by the init.rb script in env.sh are set like this:

if test -z "$CMAKE_PREFIX_PATH"; then
  CMAKE_PREFIX_PATH="/home/esrocos/esrocos_workspace/install"
else
  CMAKE_PREFIX_PATH="/home/esrocos/esrocos_workspace/install:$CMAKE_PREFIX_PATH"
fi
export CMAKE_PREFIX_PATH

This causes that, when env.sh is sourced more than once, paths are appended to the environment variables several times.

~/esrocos_workspace$ printenv PYTHONPATH
/home/esrocos/.local/lib/python3.5/site-packages:/home/esrocos/.local/lib/python3.5/site-packages:/home/esrocos/.local/lib/python3.5/site-packages:/home/esrocos/.local/lib/python3.5/site-packages:/home/esrocos/tool-inst/include/ocarina/runtime/python:/home/esrocos/tool-inst/lib:

If a variable is expected to contain a list of paths, for instance PATH, this is harmless. But if it is expected to contain a single path, for instance CMAKE_PREFIX_PATH, it causes problems.
There should be a way to define the variables in init.rb so that the path is not appended, but I couldn't find it. Any suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions