Skip to content

Commit 2565455

Browse files
committed
Try checking in usr-host/bin for programs
They might be there if we've built them but haven't installed them yet. We need topBuilddir to be a global variable for this to work. Also, use "nonnull splice" instead of "join" to slightly simplify generating the list of paths to try.
1 parent b76843c commit 2565455

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

M2/Macaulay2/m2/programs.m2

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,21 @@ findProgram(String, List) := opts -> (name, cmds) -> (
8989
instance(opts.MinimumVersion, Sequence) and
9090
class \ opts.MinimumVersion === (String, String)) then
9191
error "expected MinimumVersion to be a sequence of two strings";
92-
pathsToTry := fixPath \ join(
92+
pathsToTry := fixPath \ nonnull flatten {
9393
-- try user-configured path first
94-
if programPaths#?name then {programPaths#name} else {},
94+
if programPaths#?name then programPaths#name,
9595
-- now try M2-installed path
96-
{prefixDirectory | currentLayout#"programs"},
96+
prefixDirectory | currentLayout#"programs",
9797
-- any additional paths specified by the caller
98-
opts.AdditionalPaths,
98+
opts.AdditionalPaths,
9999
-- try PATH
100-
if getenv "PATH" == "" then {} else apply(separate(":", getenv "PATH"),
100+
if getenv "PATH" =!= "" then apply(
101+
separate(":", getenv "PATH"),
101102
dir -> if dir == "" then "." else dir),
102103
-- try directory containing M2-binary
103-
{bindir});
104+
bindir,
105+
-- try usr-host/bin
106+
if topBuilddir =!= null then topBuilddir | "usr-host/bin"};
104107
prefixes := {(".*", "")} | opts.Prefix;
105108
errorCode := didNotFindProgram;
106109
versionFound := "0.0";

M2/Macaulay2/m2/startup.m2.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ if not firstTime then debug Core -- we need access to the private symbols (we re
4040
toString := value' getGlobalSymbol if firstTime then "simpleToString" else "toString"
4141

4242
local exe
43-
local topBuilddir
4443

4544
-- this next bit has to be *parsed* after the "debug" above, to prevent the symbols from being added to the User dictionary
4645
if firstTime then (

0 commit comments

Comments
 (0)