mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-16 14:33:00 +00:00
yarn: allow jlpm to be used instead
This commit is contained in:
19
setup.py
19
setup.py
@@ -268,7 +268,6 @@ class JSX(BaseCommand):
|
|||||||
|
|
||||||
jsx_dir = pjoin(here, 'jsx')
|
jsx_dir = pjoin(here, 'jsx')
|
||||||
js_target = pjoin(static, 'js', 'admin-react.js')
|
js_target = pjoin(static, 'js', 'admin-react.js')
|
||||||
yarn_bin = 'yarn'
|
|
||||||
|
|
||||||
def should_run(self):
|
def should_run(self):
|
||||||
update_needed = False
|
update_needed = False
|
||||||
@@ -280,9 +279,6 @@ class JSX(BaseCommand):
|
|||||||
jsx_mtime = recursive_mtime(self.jsx_dir)
|
jsx_mtime = recursive_mtime(self.jsx_dir)
|
||||||
if js_target_mtime < jsx_mtime:
|
if js_target_mtime < jsx_mtime:
|
||||||
update_needed = True
|
update_needed = True
|
||||||
|
|
||||||
if update_needed and not shutil.which('yarn'):
|
|
||||||
raise Exception('JSX needs to be updated but yarn is not installed')
|
|
||||||
return update_needed
|
return update_needed
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
@@ -290,23 +286,32 @@ class JSX(BaseCommand):
|
|||||||
print("JSX admin app is up to date")
|
print("JSX admin app is up to date")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# jlpm is a version of yarn bundled with JupyterLab
|
||||||
|
if shutil.which('yarn'):
|
||||||
|
yarn = 'yarn'
|
||||||
|
elif shutil.which('jlpm'):
|
||||||
|
print("yarn not found, using jlpm")
|
||||||
|
yarn = 'jlpm'
|
||||||
|
else:
|
||||||
|
raise Exception('JSX needs to be updated but yarn is not installed')
|
||||||
|
|
||||||
print("Installing JSX admin app requirements")
|
print("Installing JSX admin app requirements")
|
||||||
check_call(
|
check_call(
|
||||||
[self.yarn_bin],
|
[yarn],
|
||||||
cwd=self.jsx_dir,
|
cwd=self.jsx_dir,
|
||||||
shell=shell,
|
shell=shell,
|
||||||
)
|
)
|
||||||
|
|
||||||
print("Building JSX admin app")
|
print("Building JSX admin app")
|
||||||
check_call(
|
check_call(
|
||||||
[self.yarn_bin, 'build'],
|
[yarn, 'build'],
|
||||||
cwd=self.jsx_dir,
|
cwd=self.jsx_dir,
|
||||||
shell=shell,
|
shell=shell,
|
||||||
)
|
)
|
||||||
|
|
||||||
print("Copying JSX admin app to static/js")
|
print("Copying JSX admin app to static/js")
|
||||||
check_call(
|
check_call(
|
||||||
[self.yarn_bin, 'place'],
|
[yarn, 'place'],
|
||||||
cwd=self.jsx_dir,
|
cwd=self.jsx_dir,
|
||||||
shell=shell,
|
shell=shell,
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user