>From c50fc3ec734cb94e78168a4a29c9aff070f4ae9f Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 7 Feb 2020 08:41:24 +0100 Subject: [PATCH 4/5] gnu: Add package python-jupyterlab * gnu/packages/python-xyz.scm (python-jupyterlab): New variable. --- .../python-jupyterlab-copy-nometa.patch | 33 +++++++++++ gnu/packages/python-xyz.scm | 55 +++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 gnu/packages/patches/python-jupyterlab-copy-nometa.patch diff --git a/gnu/packages/patches/python-jupyterlab-copy-nometa.patch b/gnu/packages/patches/python-jupyterlab-copy-nometa.patch new file mode 100644 index 0000000000..5e770c0f47 --- /dev/null +++ b/gnu/packages/patches/python-jupyterlab-copy-nometa.patch @@ -0,0 +1,33 @@ +diff '--exclude=*.swp' -Naur jupyterlab-1.2.6.orig/jupyterlab/commands.py jupyterlab-1.2.6/jupyterlab/commands.py +--- jupyterlab-1.2.6.orig/jupyterlab/commands.py 2020-01-24 17:25:16.238353500 +0100 ++++ jupyterlab-1.2.6/jupyterlab/commands.py 2020-01-31 12:36:10.497375982 +0100 +@@ -1100,7 +1100,7 @@ + 'webpack.prod.minimize.config.js', + '.yarnrc', 'yarn.js']: + target = pjoin(staging, fname) +- shutil.copy(pjoin(HERE, 'staging', fname), target) ++ shutil.copyfile(pjoin(HERE, 'staging', fname), target) + + # Ensure a clean templates directory + templates = pjoin(staging, 'templates') +@@ -1108,7 +1108,10 @@ + _rmtree(templates, self.logger) + + try: +- shutil.copytree(pjoin(HERE, 'staging', 'templates'), templates) ++ shutil.copytree(pjoin(HERE, 'staging', 'templates'), templates, ++ copy_function=shutil.copyfile) ++ # cannot replace or disable copytree’s call to .copystat ++ os.chmod (templates, 0o755) + except shutil.Error as error: + # `copytree` throws an error if copying to + from NFS even though + # the copy is successful (see https://bugs.python.org/issue24564 +@@ -1178,7 +1181,7 @@ + with open(lock_path, 'w', encoding='utf-8') as f: + f.write(template) + elif not osp.exists(lock_path): +- shutil.copy(lock_template, lock_path) ++ shutil.copyfile(lock_template, lock_path) + + def _get_package_template(self, silent=False): + """Get the template the for staging package.json file. diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 92ee53fe6f..232841ccb1 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -126,6 +126,7 @@ #:use-module (gnu packages multiprecision) #:use-module (gnu packages networking) #:use-module (gnu packages ncurses) + #:use-module (gnu packages node) #:use-module (gnu packages openstack) #:use-module (gnu packages pcre) #:use-module (gnu packages perl) @@ -17656,3 +17657,57 @@ dumping of JSON5 data structures.") (description "A set of server components for JupyterLab and JupyterLab like applications") (license license:bsd-3))) + +(define-public python-jupyterlab + (package + (name "python-jupyterlab") + (version "1.2.6") + (source + (origin + (method url-fetch) + (uri (pypi-uri "jupyterlab" version)) + (sha256 + (base32 + "0mc3nrj7fc5q2ajr09m261j386jsp8qjljg8anghlh8czc9ln4s2")) + (patches (search-patches "python-jupyterlab-copy-nometa.patch")))) + (build-system python-build-system) + (propagated-inputs + `(("python-jinja2" ,python-jinja2) + ("python-jupyterlab-server" + ,python-jupyterlab-server) + ("python-notebook" ,python-notebook) + ("python-tornado" ,python-tornado) + ("node" ,node))) + (native-inputs + `(("python-pytest" ,python-pytest) + ("python-pytest-check-links" + ,python-pytest-check-links) + ("python-requests" ,python-requests) + ("python-ipykernel" ,python-ipykernel))) + (arguments + ;; testing requires npm, so disabled for now + '(#:tests? #f + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'patch-syspath + (lambda* (#:key outputs inputs configure-flags #:allow-other-keys) + (let* ((out (assoc-ref outputs "out"))) + (substitute* "jupyterlab/commands.py" + ;; sys.prefix defaults to Python’s prefix in the store, not + ;; jupyterlab’s. Fix that. + (("sys\\.prefix") + (string-append "'" out "'")))) + #t)) + ;; 'build does not respect configure-flags + (replace 'build + (lambda _ + (invoke "python" "setup.py" "build" "--skip-npm")))) + #:configure-flags (list "--skip-npm"))) + (home-page "https://jupyter.org") + (synopsis + "The JupyterLab notebook server extension") + (description + "An extensible environment for interactive and reproducible computing, +based on the Jupyter Notebook and Architecture.") + (license license:bsd-3))) + -- 2.20.1