The dependencies for cogs are few. cogs as a library needs:
- ERS
nlohmann::json
To build the cogs demo, additionally:
- moo
This guide is for SL7 (or similar) base OS. If your native OS is not SL7 one method to test this guide is with a minimal Docker or Singularity container and use Fermilab UPS products from CVMFS to fill in the gaps by running something like:
$ singularity exec --bind /cvmfs /path/to/sl7.simg env -i bash --rcfile login.rc
The login.rc
just sets PS1
to something reasonable.
Some environment setup is needed. How much depends on how much of cogs to test. A full setup script with guiding comments:
Use like:
$ mkdir /path/to/work $ cd /path/to/work $ source /path/to/wherever/build-sl7-setup.sh
Moo is a Python package (which means Python3 as Python2 has ceased). The package should build from source in any of the “usual” Python manners. In future it may be provided from PyPI. Here is one example:
$ python -m venv $TOP/venv $ source $TOP/venv/bin/activate $ git clone https://github.com/brettviren/moo.git $ pip install -e .
Note: if using the setup script above, next time you use it this area will be activated.
The moo
command should now be available:
$ moo Usage: moo [OPTIONS] COMMAND [ARGS]... moo command line interface Options: --help Show this message and exit. Commands: compile Compile a model to JSON imports Emit a list of imports required by the model many Render many files render Render a template against a model. render-many Render many files for a project. validate Validate a model against a schema
Ultimately, this is just a single header.
$ mkdir -p $TOP/include/nlohmann $ wget -O $TOP/include/nlohmann/json.hpp https://github.com/nlohmann/json/releases/download/v3.8.0/json.hpp
The cogs
package is built with plain Waf.
$ wget -O $TOP/bin/waf https://waf.io/waf-2.0.20 $ chmod +x $TOP/bin/waf $ waf --version waf 2.0.20 (668769470956da8c5b60817cb8884cd7d0f87cd4)
Now cogs:
$ cd $TOP $ git clone https://github.com/brettviren/cogs.git $ cd cogs $ waf --help ## no demo $ waf configure --prefix=$TOP \ --with-ers=$ERS_FQ_DIR \ --with-boost=$BOOST_FQ_DIR \ --with-nljs=$TOP \ ## with demo $ waf configure --prefix=$TOP \ --with-ers=$ERS_FQ_DIR \ --with-boost=$BOOST_FQ_DIR \ --with-nljs=$TOP # waf install
The demo main program can be check via:
$ cogs-demo 2020-Jun-27 19:54:47,027 INFO [main(...) at unknown/demo/cogs-demo.cpp:12] usage: cogs-demo <uri>