Skip to content

Instantly share code, notes, and snippets.

@hirochachacha
Created January 19, 2012 13:27
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 hirochachacha/1640047 to your computer and use it in GitHub Desktop.
Save hirochachacha/1640047 to your computer and use it in GitHub Desktop.
pycco on the fly
#!/bin/bash --
set -e
TEMP_DIR="/tmp/pycco-$$"
PYTHON_DIR=$(python -c "import $1; import os; print(os.path.dirname($1.__file__))")
trap "rm -rf $TEMP_DIR" EXIT
mkdir $TEMP_DIR
find $PYTHON_DIR -name '*.py' -type f | xargs pycco -d $TEMP_DIR
sleep 1 && python -c "import webbrowser; webbrowser.open('http://localhost:8000/')" &
cd $TEMP_DIR && python -m SimpleHTTPServer 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment