From 4c7f5972e120edea35170648a12c7a8da73b65a9 Mon Sep 17 00:00:00 2001 From: Min RK Date: Sat, 7 May 2016 12:24:44 +0100 Subject: [PATCH] add npm run build:css setup.py css is just an alias for this, so there should be no more calls back to Python from npm run build:anything --- package.json | 4 +++- setupbase.py | 24 ++++++------------------ 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 1edbc92ee..1f67a82a1 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,9 @@ "bower": "bower install --allow-root --config.interactive=false", "build:watch": "concurrent \"npm run build:css:watch\" \"npm run build:js:watch\"", "build": "npm run build:css && npm run build:js", - "build:css": "python setup.py css", + "build:css": "concurrent 'npm run build:css:ipython' 'npm run build:css:style'", + "build:css:ipython": "lessc --source-map --include-path=notebook/static notebook/static/style/ipython.less notebook/static/style/ipython.min.css", + "build:css:style": "lessc --source-map --include-path=notebook/static notebook/static/style/style.less notebook/static/style/style.min.css", "build:css:watch": "echo Not implemented yet...", "build:js": "webpack", "build:js:watch": "npm run build:js -- --watch" diff --git a/setupbase.py b/setupbase.py index 853333fb4..334be80d4 100644 --- a/setupbase.py +++ b/setupbase.py @@ -403,29 +403,17 @@ class CompileCSS(Command): def finalize_options(self): pass - sources = [] targets = [] for name in ('ipython', 'style'): - sources.append(pjoin(static, 'style', '%s.less' % name)) targets.append(pjoin(static, 'style', '%s.min.css' % name)) def run(self): - self.run_command('jsdeps') - env = os.environ.copy() - env['PATH'] = npm_path - - for src, dst in zip(self.sources, self.targets): - try: - run(['lessc', - '--source-map', - '--include-path=%s' % pipes.quote(static), - src, - dst, - ], cwd=repo_root, env=env) - except OSError as e: - print("Failed to build css: %s" % e, file=sys.stderr) - print("You can install js dependencies with `npm install`", file=sys.stderr) - raise + try: + run(['npm', 'run', 'build:css']) + except OSError as e: + print("Failed to run npm run build:css : %s" % e, file=sys.stderr) + print("You can install js dependencies with `npm install`", file=sys.stderr) + raise # update package data in case this created new files update_package_data(self.distribution)