[Pkg-javascript-devel] packaging and debuging of the javascript part of ipywidgets

picca picca at debian.org
Tue Dec 24 10:19:06 GMT 2024


Hello,

with the upstream build it works out of the box, this is a great news.

Now I am switching to the Debian Javascript team way and I end up with 
this message during the build

make[1]: Entering directory '/<<PKGBUILDDIR>>'
dh_auto_build --buildsystem=nodejs
/!\ examples/embed-amd/package.json not found
Unable to load examples/embed-amd
./lerna.json found

workspaces field found in package.json

Found debian/nodejs/additional_components
Adding component(s): packages/base
Adding component(s): packages/base-manager
Adding component(s): packages/controls
Adding component(s): packages/html-manager
No build command found, searching known files


The upstream use jlpm build with is doing


[console_scripts]
jlpm = jupyterlab.jlpmapp:main


"""A Jupyter-aware wrapper for the yarn package manager"""

import os

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import sys

from jupyterlab_server.process import subprocess, which

HERE = os.path.dirname(os.path.abspath(__file__))
YARN_PATH = os.path.join(HERE, "staging", "yarn.js")


def execvp(cmd, argv):
     """Execvp, except on Windows where it uses Popen.

     The first argument, by convention, should point to the filename
     associated with the file being executed.

     Python provides execvp on Windows, but its behavior is problematic
     (Python bug#9148).
     """
     cmd = which(cmd)
     if os.name == "nt":
         import signal
         import sys

         p = subprocess.Popen([cmd] + argv[1:])
         # Don't raise KeyboardInterrupt in the parent process.
         # Set this after spawning, to avoid subprocess inheriting 
handler.
         signal.signal(signal.SIGINT, signal.SIG_IGN)
         p.wait()
         sys.exit(p.returncode)
     else:
         os.execvp(cmd, argv)  # noqa S606


def main(argv=None):
     """Run node and return the result."""
     # Make sure node is available.
     argv = argv or sys.argv[1:]
     execvp("node", ["node", YARN_PATH, *argv])



so it seems that the upstream run node with there own version of yarn.js



#!/usr/bin/node

let yarnpkg = '/usr/bin/yarnpkg';
let command = process.env.YARNCOMMAND || yarnpkg;

const { spawn } = require('child_process');

let argv = process.argv.slice(2)

const ls = spawn(command, argv);

ls.stdout.on('data', (data) => {
   console.log(data.toString());
});

ls.stderr.on('data', (data) => {
   console.error(data.toString());
});

ls.on('close', (code) => {
   process.exit(code);
});

So at some point I need to tell dh-nodejs, that I need to run this 
script with the right YARNCOMMAND.

I can add a debian/nodejs/build file as explain in the doc here[1],

I put `jlmp build` inside but the error is still the same

Cheers

Fred

[1] 
https://salsa.debian.org/js-team/pkg-js-tools/tree/master/doc/tools#pkg-js-tools-files







More information about the Pkg-javascript-devel mailing list