Skip to content

Commit

Permalink
Merge pull request #4696 from ivanov/process-to-launcher
Browse files Browse the repository at this point in the history
move process utilities to jupyterlab_launcher
  • Loading branch information
afshin committed Jun 13, 2018
2 parents 296b92d + 1b3aa8f commit a76fd32
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 337 deletions.
4 changes: 2 additions & 2 deletions jupyterlab/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

from ipython_genutils.tempdir import TemporaryDirectory
from jupyter_core.paths import jupyter_config_path
from jupyterlab_launcher.process import which, Process, WatchHelper
from notebook.nbextensions import GREEN_ENABLED, GREEN_OK, RED_DISABLED, RED_X

from .semver import Range, gte, lt, lte, gt, make_semver
from .jlpmapp import YARN_PATH, HERE, which
from .process import Process, WatchHelper
from .jlpmapp import YARN_PATH, HERE

if sys.version_info.major < 3:
from urllib2 import Request, urlopen, quote
Expand Down
36 changes: 1 addition & 35 deletions jupyterlab/jlpmapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@
import sys

import os
from ipython_genutils.py3compat import which as _which

try:
import subprocess32 as subprocess
except ImportError:
import subprocess
from jupyterlab_launcher.process import which, subprocess

HERE = os.path.dirname(os.path.abspath(__file__))
YARN_PATH = os.path.join(HERE, 'staging', 'yarn.js')
Expand Down Expand Up @@ -39,35 +34,6 @@ def execvp(cmd, argv):
else:
os.execvp(cmd, argv)


def which(command, env=None):
"""Get the full path to a command.
Parameters
----------
command: str
The command name or path.
env: dict, optional
The environment variables, defaults to `os.environ`.
"""
env = env or os.environ
path = env.get('PATH') or os.defpath
command_with_path = _which(command, path=path)

# Allow nodejs as an alias to node.
if command == 'node' and not command_with_path:
command = 'nodejs'
command_with_path = _which('nodejs', path=path)

if not command_with_path:
if command in ['nodejs', 'node', 'npm']:
msg = 'Please install nodejs 5+ and npm before continuing installation. nodejs may be installed using conda or directly from the nodejs website.'
raise ValueError(msg)
raise ValueError('The command was not found or was not ' +
'executable: %s.' % command)
return command_with_path


def main(argv=None):
"""Run node and return the result.
"""
Expand Down
253 changes: 0 additions & 253 deletions jupyterlab/process.py

This file was deleted.

43 changes: 0 additions & 43 deletions jupyterlab/process_app.py

This file was deleted.

2 changes: 1 addition & 1 deletion jupyterlab/tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from ipykernel.kernelspec import write_kernel_spec
import jupyter_core

from jupyterlab.process_app import ProcessApp
from jupyterlab_launcher.process_app import ProcessApp


HERE = osp.realpath(osp.dirname(__file__))
Expand Down
4 changes: 2 additions & 2 deletions packages/services/examples/node/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from __future__ import print_function, absolute_import
import json
import os
from jupyterlab.process import which
from jupyterlab.process_app import ProcessApp
from jupyterlab_launcher.process import which
from jupyterlab_launcher.process_app import ProcessApp

HERE = os.path.dirname(os.path.realpath(__file__))

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def run(self):

setup_args['install_requires'] = [
'notebook>=4.3.1',
'jupyterlab_launcher>=0.10.0,<0.11.0',
'jupyterlab_launcher>=0.11.0,<0.12.0',
'ipython_genutils',
'futures;python_version<"3.0"',
'subprocess32;python_version<"3.0"'
Expand Down

0 comments on commit a76fd32

Please sign in to comment.