Skip to content

Commit

Permalink
Added examples to the conda build
Browse files Browse the repository at this point in the history
  • Loading branch information
jbednar committed Aug 18, 2016
1 parent 0c7cd3f commit d7b1813
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
1 change: 1 addition & 0 deletions conda.recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ SRC_DIR=$RECIPE_DIR/..
pushd $SRC_DIR

$PYTHON setup.py --quiet install --single-version-externally-managed --record=record.txt
cp -r $SRC_DIR/examples $PREFIX/share/datashader-examples

popd

27 changes: 12 additions & 15 deletions datashader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,20 @@ def test():
pytest.main(os.path.dirname(__file__))


def examples(path='.', verbose=False):
def examples(path='datashader-examples', verbose=False):
"""
Copies the examples to the supplied path.
"""

import os, glob
from shutil import copyfile

path = os.path.abspath(path)
if not os.path.exists(path):
os.makedirs(path)
if verbose: print('Created directory %s' % path)

notebook_glob = os.path.join(__path__[0], '..', 'examples', '*')
notebooks = glob.glob(notebook_glob)

for notebook in notebooks:
nb_path = os.path.join(path, os.path.basename(notebook))
copyfile(notebook, nb_path)
if verbose: print("%s copied to %s" % (os.path.basename(notebook), path))
from shutil import copytree, ignore_patterns

candidates = [os.path.join(__path__[0], '../examples'),
os.path.join(__path__[0], '../../../../share/datashader-examples')]

for source in candidates:
if os.path.exists(source):
copytree(source, path, ignore=ignore_patterns('data','.ipynb_checkpoints','*.pyc','*~'))
if verbose:
print("%s copied to %s" % (source, path))
break
6 changes: 3 additions & 3 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ To get a copy of the examples in your own directory so that you can
run and edit them, you can run these commands in your terminal:

```bash
1. mkdir ~/datashader-examples
2. cd ~/datashader-examples
3. python -c 'from datashader import examples ; examples()'
1. cd ~
2. python -c 'from datashader import examples ; examples("datashader-examples")'
3. cd datashader-examples
4. python download_sample_data.py
```

Expand Down

0 comments on commit d7b1813

Please sign in to comment.