瀏覽代碼

Merge pull request #7813 from blink1073/fix-browser-check

Fix browser check
Steven Silvester 5 年之前
父節點
當前提交
60ce637485
共有 2 個文件被更改,包括 4 次插入18 次删除
  1. 2 9
      examples/example_check.py
  2. 2 9
      jupyterlab/browser_check.py

+ 2 - 9
examples/example_check.py

@@ -16,7 +16,6 @@ import os
 import shutil
 import sys
 import subprocess
-from tempfile import TemporaryDirectory
 
 from tornado.ioloop import IOLoop
 from traitlets import Bool, Unicode
@@ -57,14 +56,8 @@ def run_browser(url):
     target = osp.join(get_app_dir(), 'example_test')
     if not osp.exists(osp.join(target, 'node_modules')):
         os.makedirs(target)
-        # Install puppeteer in a temporary directory.
-        # This is to avoid an issue seen in CI where running yarn
-        # In the application directory resulted in the whole Python
-        # install getting removed
-        with TemporaryDirectory() as tdname:
-          subprocess.call(["jlpm"], cwd=tdname)
-          subprocess.call(["jlpm", "add", "puppeteer"], cwd=tdname)
-          shutil.copytree(osp.join(tdname, 'node_modules'), osp.join(target, 'node_modules'))
+        subprocess.call(["jlpm", "init", "-y"], cwd=target)
+        subprocess.call(["jlpm", "add", "puppeteer"], cwd=target)
     shutil.copy(osp.join(here, 'chrome-example-test.js'), osp.join(target, 'chrome-example-test.js'))
     return subprocess.check_call(["node", "chrome-example-test.js", url], cwd=target)
 

+ 2 - 9
jupyterlab/browser_check.py

@@ -11,7 +11,6 @@ import os
 import shutil
 import sys
 import subprocess
-from tempfile import TemporaryDirectory
 
 from tornado.ioloop import IOLoop
 from notebook.notebookapp import flags, aliases
@@ -110,14 +109,8 @@ def run_browser(url):
     target = osp.join(get_app_dir(), 'browser_test')
     if not osp.exists(osp.join(target, 'node_modules')):
         os.makedirs(target)
-        # Install puppeteer in a temporary directory.
-        # This is to avoid an issue seen in CI where running yarn
-        # In the application directory resulted in the whole Python
-        # install getting removed
-        with TemporaryDirectory() as tdname:
-          subprocess.call(["jlpm"], cwd=tdname)
-          subprocess.call(["jlpm", "add", "puppeteer"], cwd=tdname)
-          shutil.copytree(osp.join(tdname, 'node_modules'), osp.join(target, 'node_modules'))
+        subprocess.call(["jlpm", "init", "-y"], cwd=target)
+        subprocess.call(["jlpm", "add", "puppeteer"], cwd=target)
     shutil.copy(osp.join(here, 'chrome-test.js'), osp.join(target, 'chrome-test.js'))
     return subprocess.check_call(["node", "chrome-test.js", url], cwd=target)