Skip to content

Commit

Permalink
Don't build the labextension if npm is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Jan 11, 2021
1 parent 97095f4 commit 71393b8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion jupytext/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Jupytext's version number"""

__version__ = "1.9.1"
__version__ = "1.9.1+dev"
21 changes: 19 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from os import path
from os import path, environ
from io import open
import re
from setuptools import setup, find_packages
import subprocess
import warnings

from jupyter_packaging import (
create_cmdclass,
Expand Down Expand Up @@ -59,7 +61,6 @@
package_data_spec={"jupytext": ["nbextension/**"]},
data_files_spec=data_files_spec,
)

cmdclass["jsdeps"] = combine_commands(
install_npm(
path.join(this_directory, "packages", "labextension"),
Expand All @@ -69,6 +70,22 @@
ensure_targets(jstargets),
)

# We don't build the extensions if npm is not available
# Cf. https://github.com/mwouts/jupytext/issues/706
try:
proc = subprocess.Popen(["npm", "--version"])
except FileNotFoundError:
warnings.warn(
"The jupyterlab-jupytext extension could not be build. "
"Please install nodejs if you need the extensions. "
"See also https://github.com/mwouts/jupytext/issues/706."
)
cmdclass = {}

# We can't allow this on the CI, as we publish the package with PyPi-publish
if environ.get("CI"):
raise RuntimeError("Please install npm.")

setup(
name="jupytext",
version=version,
Expand Down

0 comments on commit 71393b8

Please sign in to comment.