Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

[ignore] fix urth-core-import post issue in browser #548

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions nb-extension/python/urth/widgets/ext/urth_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
widgets_dir = ''
logger = None

# In Windows`bower` is not an `.exe` (see #373)
cmd_bower = ['cmd', '/C', 'bower'] if os.name == 'nt' else ['bower']

class UrthImportHandler(RequestHandler):

Expand All @@ -26,7 +28,7 @@ def initialize(self, executor):
def get(self):
os.chdir(widgets_dir)
try:
proc = subprocess.check_output(['bower', 'list', '--allow-root', '--config.interactive=false', '-o', '-p', '-j'])
proc = subprocess.check_output(cmd_bower + ['list', '--allow-root', '--config.interactive=false', '-o', '-p', '-j'])
d = json.loads(proc.decode('utf-8'))
for k in d.keys():
v = d[k]
Expand Down Expand Up @@ -64,11 +66,8 @@ def post(self):
# and non-zero for an error.
def do_install(package_name):
logger.info('Installing %r', package_name)
args = ['bower', 'install', package_name, '--allow-root',
args = cmd_bower + ['install', package_name, '--allow-root',
'--config.interactive=false', '--production', '--quiet']
# In Windows`bower` is not an `.exe` (see #373)
if os.name == 'nt':
args = ['cmd', '/C'] + args
try:
subprocess.check_call(args, cwd=widgets_dir)
except subprocess.CalledProcessError as e:
Expand Down