From b1562cd21a089bfe2221075fae4e0abb95d68c84 Mon Sep 17 00:00:00 2001 From: Min RK Date: Wed, 22 Apr 2015 16:10:46 -0700 Subject: [PATCH] properly update package_data after components changes build_py wasn't getting updated, causing it to leave out components fetched during setup --- .travis.yml | 2 +- setupbase.py | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1064f378a..9a8b0e08b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ before_install: - 'if [[ $GROUP == js* ]]; then npm install -g casperjs; fi' - git clone --quiet --depth 1 https://github.com/minrk/travis-wheels travis-wheels install: - - pip install -f travis-wheels/wheelhouse -r requirements.txt -e file://$PWD#egg=jupyter_notebook[test] coveralls + - pip install -f travis-wheels/wheelhouse -r requirements.txt file://$PWD#egg=jupyter_notebook[test] coveralls script: - 'if [[ $GROUP == js* ]]; then python -m jupyter_notebook.jstest $GROUP; fi' - 'if [[ $GROUP == python ]]; then nosetests --with-coverage --cover-package=jupyter_notebook jupyter_notebook; fi' diff --git a/setupbase.py b/setupbase.py index d106ea106..1ae2ab84a 100644 --- a/setupbase.py +++ b/setupbase.py @@ -194,6 +194,13 @@ def check_package_data_first(command): command.run(self) return DecoratedCommand +def update_package_data(distribution): + """update package_data to catch changes during setup""" + build_py = distribution.get_command_obj('build_py') + distribution.package_data = find_package_data() + # re-init build_py options which load package_data + build_py.finalize_options() + #--------------------------------------------------------------------------- # Notebook related #--------------------------------------------------------------------------- @@ -276,7 +283,7 @@ def mtime(path): """shorthand for mtime""" return os.stat(path).st_mtime -py3compat_ns = {} + class Bower(Command): description = "fetch static client-side components with bower" @@ -334,7 +341,7 @@ class Bower(Command): raise os.utime(self.bower_dir, None) # update package data in case this created new files - self.distribution.package_data = find_package_data() + update_package_data(self.distribution) class CompileCSS(Command): @@ -365,7 +372,7 @@ class CompileCSS(Command): print("You can install js dependencies with `npm install`", file=sys.stderr) raise # update package data in case this created new files - self.distribution.package_data = find_package_data() + update_package_data(self.distribution) class JavascriptVersion(Command):