Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to setup.py for pip install #1782

Merged
merged 4 commits into from Aug 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion holoviews/util/__init__.py
Expand Up @@ -15,6 +15,7 @@
Store.output_settings = OutputSettings



def examples(path='holoviews-examples', verbose=False, force=False, root=__file__):
"""
Copies the notebooks to the supplied path.
Expand All @@ -36,7 +37,6 @@ def examples(path='holoviews-examples', verbose=False, force=False, root=__file_
print('Cannot find %s' % tree_root)



class opts(param.ParameterizedFunction):
"""
Utility function to set options either at the global level or on a
Expand Down
2 changes: 1 addition & 1 deletion holoviews/util/command.py
Expand Up @@ -15,7 +15,7 @@
try:
import nbformat, nbconvert
except:
print('Both nbformat and nbconvert need to be installed to use the holoviews command')
print('nbformat, nbconvert and ipython need to be installed to use the holoviews command')
sys.exit()
try:
from ..ipython.preprocessors import OptsMagicProcessor, OutputMagicProcessor
Expand Down
31 changes: 27 additions & 4 deletions setup.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python

import sys, os, glob
from shutil import rmtree
import shutil
from collections import defaultdict
try:
from setuptools import setup
Expand Down Expand Up @@ -110,12 +110,35 @@ def walker(top, names):
extensions[package].append(ext_str)


# Note: This function should be identical to util.examples
# (unfortunate and unavoidable duplication)
def examples(path='holoviews-examples', verbose=False, force=False, root=__file__):
"""
Copies the notebooks to the supplied path.
"""
filepath = os.path.abspath(os.path.dirname(root))
example_dir = os.path.join(filepath, './examples')
if not os.path.exists(example_dir):
example_dir = os.path.join(filepath, '../examples')
if os.path.exists(path):
if not force:
print('%s directory already exists, either delete it or set the force flag' % path)
return
shutil.rmtree(path)
ignore = shutil.ignore_patterns('.ipynb_checkpoints','*.pyc','*~')
tree_root = os.path.abspath(example_dir)
if os.path.isdir(tree_root):
shutil.copytree(tree_root, path, ignore=ignore, symlinks=True)
else:
print('Cannot find %s' % tree_root)



def package_assets(example_path):
"""
Generates pseudo-packages for the examples directory.
"""
import holoviews
holoviews.util.examples(example_path, force=True, root=__file__)
examples(example_path, force=True, root=__file__)
for root, dirs, files in os.walk(example_path):
walker(root, dirs+files)
setup_args['packages'] += packages
Expand Down Expand Up @@ -153,4 +176,4 @@ def package_assets(example_path):
setup(**setup_args)

if os.path.isdir(example_path):
rmtree(example_path)
shutil.rmtree(example_path)