octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #60054] feature request: package install with


From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #60054] feature request: package install with dependency on java.
Date: Mon, 15 Feb 2021 09:18:42 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #3, bug #60054 (project octave):

A note about PKG_ADD/PKG_DEL:

Rather than incorporate a lot of code in PKG_ADD / PKG_DEL files, it's better
to make PKG_ADD / PKG_DEL call dedicated initialization functions or scripts.
In addition, watch out for polluting the workspace by silently introducing
variables used for initialization w/o clearing them afterwards.

Other than that I think both of you have valid points.

Entering required Java versions in DESCRIPTION won't work as TTBOMK  Octave
has no function to request version info from JAVA. The io package has a very
rudimentary function (./private/__chk_java_sprt__.m) with the following code:

:
    jver = ...
      char (javaMethod ("getProperty", "java.lang.System", "java.version"));
    cjver = strsplit (jver, ".");
    ## Before Java 9 the numbering scheme is "1.ver.x_y".
    ## For Java 9 it is "ver.x.y".
    ## For Java 10 and 11 it is just "ver".
    java_ver = [];
    if (numel (cjver) > 1 && (sscanf (cjver{1}, "%d") == 1))
      java_ver = sscanf (cjver{2}, "%d");
    elseif (! isempty (cjver))
      java_ver = sscanf (cjver{1}, "%d");
    endif
:


(I don't claim it's Good but it Just works)

My advice would be to create e.g.,  __init_<pkg-name>__.m and
__exit_<pkg-name>__.m  scripts or functions, call them from PKG_ADD and
PKG_DEL, resp., and use those to init and de-init the required Java stuff.
These days Octave can select a specific Java version from multiple Java
installations installed side-by-side by setting JAVA_HOME with setenv(), so
there you have additional flexibility.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60054>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]