Include bower components during `setup.py install`, and use properly use relative static directory during export.

This commit is contained in:
Tim Buckley 2015-08-13 14:45:09 -06:00
parent e3d841f2b7
commit 2b799786b8
2 changed files with 7 additions and 2 deletions

View File

@ -4,3 +4,5 @@ exclude .gitignore
exclude .gitreview exclude .gitreview
global-exclude *.pyc global-exclude *.pyc
graft stackviz/static/components

View File

@ -35,6 +35,9 @@ EXPORT_PATHS = [
] ]
_base = os.path.dirname(os.path.abspath(__file__))
def fake_render_view(path): def fake_render_view(path):
factory = RequestFactory() factory = RequestFactory()
request = factory.get(path) request = factory.get(path)
@ -107,7 +110,7 @@ def main():
args = parser.parse_args() args = parser.parse_args()
if not args.ignore_bower: if not args.ignore_bower:
if not os.listdir(os.path.join('stackviz', 'static', 'components')): if not os.listdir(os.path.join(_base, 'static', 'components')):
print("Bower components have not been installed, please run " print("Bower components have not been installed, please run "
"`bower install`") "`bower install`")
return 1 return 1
@ -122,7 +125,7 @@ def main():
init_django(args) init_django(args)
print("Copying static files ...") print("Copying static files ...")
shutil.copytree(os.path.join('stackviz', 'static'), shutil.copytree(os.path.join(_base, 'static'),
os.path.join(args.path, 'static')) os.path.join(args.path, 'static'))
for path in EXPORT_PATHS: for path in EXPORT_PATHS: