Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
replace conda with condalog to get pass through behavior
#! /bin/bash
LOGBOOK=bs-testing
pkg_list_base="/tmp/automated-list-of-conda-packages"
echo "pkg_list_base=$pkg_list_base"
#exit 1
echo "
Capturing current list of conda packages in
[$CONDA_DEFAULT_ENV]
(if empty, you are in the root environment
"
conda list -e > $pkg_list_base-before.txt
conda $*
#source activate /tmp/foo
echo "
Capturing current list of conda packages in
[$CONDA_DEFAULT_ENV]
(if empty, you are in the root environment
"
conda list -e > $pkg_list_base-after.txt
diff $pkg_list_base-before.txt $pkg_list_base-after.txt > $pkg_list_base-diff.txt
echo "
Package diff:
"
cat $pkg_list_base-diff.txt
echo "
Uploading to $LOGBOOK
"
python -c "from pyOlog.cli.ipy import olog; \
from pyOlog.OlogDataTypes import Attachment; \
import os; \
olog(msg='conda $*', \
logbooks='$LOGBOOK', \
attachments=[Attachment(open('$pkg_list_base-before.txt', 'r')), \
Attachment(open('$pkg_list_base-after.txt', 'r')), \
Attachment(open('$pkg_list_base-diff.txt', 'r'))])"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment