Skip to content

Commit

Permalink
Merge pull request maximilianh#186 from kriemo/dataroot
Browse files Browse the repository at this point in the history
add environment variable option (CBDATAROOT) to define dataRoot
  • Loading branch information
maximilianh committed Aug 12, 2020
2 parents 61e9d20 + f2ae12b commit 9582357
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ Add a statement like the following to your ``~/.cellbrowser.conf``::

dataRoot='/celldata/'

Alternatively, ``dataRoot`` can be set using the ``CBDATAROOT`` environment variable::

export CBDATAROOT='/celldata/'

Then, create a "stub" cellbrowser.conf into this directory, it should only contain
a single line like ``shortLabel="some description"``.
You can describe your collection as discussed under the **Describing
Expand Down
13 changes: 10 additions & 3 deletions src/cbPyLib/cellbrowser/cellbrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4153,10 +4153,17 @@ def rebuildCollections(dataRoot, webRoot, collList):
writeJson(collInfo, collOutFname)

def findRoot(inDir=None):
" return directory dataRoot defined in config file "
dataRoot = getConfig("dataRoot")
""" return directory dataRoot defined in config file or CBDATAROOT
environment variable.
"""

if 'CBDATAROOT' in os.environ:
dataRoot = os.environ['CBDATAROOT']
else:
dataRoot = getConfig("dataRoot")

if dataRoot is None:
logging.info("dataRoot is not set in ~/.cellbrowser.conf. Dataset hierarchies are not supported.")
logging.info("dataRoot is not set in ~/.cellbrowser.conf or via $CBDATAROOT. Dataset hierarchies are not supported.")
return None

dataRoot = abspath(expanduser(dataRoot).rstrip("/"))
Expand Down

0 comments on commit 9582357

Please sign in to comment.