Skip to content

Instantly share code, notes, and snippets.

@tacaswell
Forked from ericdill/condalog.sh
Created July 1, 2016 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tacaswell/e216cc8094307f200636efedfec8eebe to your computer and use it in GitHub Desktop.
Save tacaswell/e216cc8094307f200636efedfec8eebe to your computer and use it in GitHub Desktop.
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