Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/workflows/test_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,13 @@ jobs:
- name: Build Macaulay2 using Ninja
if: matrix.build-system == 'cmake'
run: |
cmake --build . --target M2-core M2-emacs install-packages
if [[ "${{ runner.os }}" == "Linux" ]] && [[ "${{ matrix.build-system }}" == "cmake" ]]; then
cmake --build . --target M2-core M2-emacs

- name: Install packages using Ninja
if: matrix.build-system == 'cmake'
run: |
cmake --build . --target install-packages
if [[ "${{ runner.os }}" == "Linux" ]]; then
sudo apt-get install -y -q --no-install-recommends dpkg-dev
echo "GIT_COMMIT=`git describe --dirty --always --match HEAD`" >> $GITHUB_ENV
cpack -G DEB
Expand All @@ -168,6 +173,11 @@ jobs:
../../configure --with-system-gc --with-fplll

- name: Build Macaulay2 using Make
if: matrix.build-system == 'autotools'
run: |
make -j$(nproc 2>/dev/null || sysctl -n hw.logicalcpu) PACKAGES=

- name: Install packages using Make
if: matrix.build-system == 'autotools'
run: |
make -j$(nproc 2>/dev/null || sysctl -n hw.logicalcpu)
Expand Down
14 changes: 6 additions & 8 deletions M2/Macaulay2/m2/examples.m2
Original file line number Diff line number Diff line change
Expand Up @@ -124,27 +124,25 @@ capture String := opts -> s -> if opts.UserMode then capture' s else (
protect symbol capture

-- returns false if the inputs or the package are not known to behave well with capture
-- this is also used in testing.m2, where isTest is set to true.
isCapturable = (inputs, pkg, isTest) -> (
-- this is also used in testing.m2
isCapturable = (inputs, pkg) -> (
-- argumentMode is mainly used by ctest to select M2 subprocess arguments,
-- or whether capture should be avoided; see packages/CMakeLists.txt
-- alternatively, no-capture-flag can be used with an example or test
if argumentMode & NoCapture =!= 0 or match("no-capture-flag", inputs) then return false;
-- strip commented segments first
inputs = replace("--.*$", "", inputs);
inputs = replace("-\\*(.|\n)*?\\*-", "", inputs);
-- TODO: remove this when the effects of capture on other packages is reviewed
(isTest or match({"FirstPackage", "Macaulay2Doc"}, pkg#"pkgname"))
and not match({
"FastMinors", "TerraciniLoci",
not match({
"FastMinors", "TerraciniLoci", "OldPolyhedra", "Normaliz",
"MultiprojectiveVarieties", "SpecialFanoFourfolds",
"EngineTests", "ThreadedGB", "RunExternalM2"}, pkg#"pkgname")
and not (match({"Cremona"}, pkg#"pkgname") and version#"pointer size" == 4)
-- FIXME: these are workarounds to prevent bugs, in order of priority for being fixed:
and not match("(gbTrace|NAGtrace)", inputs) -- cerr/cout directly from engine isn't captured
and not match("(notify|stopIfError|debuggingMode)", inputs) -- stopIfError and debuggingMode may be fixable
and not match("(alarm|exec|exit|quit|restart|run)\\b", inputs) -- these commands interrupt the interpreter
and not match("(capture|read|input|load|needs)\\b", inputs) -- these commands hide undesirable functions
and not match("(capture|read|input|load|needs|check)\\b", inputs) -- these commands hide undesirable functions
and not match("([Cc]ommand|fork|schedule|thread|Task)", inputs) -- remove when threads work more predictably
and not match("(temporaryFileName)", inputs) -- this is sometimes bug prone
and not match("(addHook|export|newPackage)", inputs) -- these commands have permanent effects
Expand Down Expand Up @@ -242,7 +240,7 @@ storeExampleOutput = (pkg, fkey, outf, verboseLog) -> (
captureExampleOutput = (desc, inputs, pkg, inf, outf, errf, data, inputhash, changeFunc, usermode) -> (
stdio << flush; -- just in case previous timing information hasn't been flushed yet
-- try capturing in the same process
if isCapturable(inputs, pkg, false) then (
if isCapturable(inputs, pkg) then (
desc = concatenate(desc, 62 - #desc);
stderr << commentize pad("capturing " | desc, 72) << flush; -- the timing info will appear at the end
(err, output) := capture(inputs, UserMode => false);
Expand Down
2 changes: 1 addition & 1 deletion M2/Macaulay2/m2/testing.m2
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ captureTestResult := (desc, teststring, pkg, usermode) -> (
-- TODO: remove this when capture uses ArgQ
if usermode === not noinitfile then
-- try capturing in the same process
if isCapturable(teststring, pkg, true) then (
if isCapturable(teststring, pkg) then (
checkmsg("capturing", desc);
-- TODO: adjust and pass argumentMode, instead. This can be done earlier, too.
-- Note: UserMode option of capture is not related to UserMode option of check
Expand Down
4 changes: 2 additions & 2 deletions M2/Macaulay2/packages/GroebnerWalk.m2
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ Description
Text
while running at Level 2 gives some conversion information.
Example
setWalkTrace 2;
setWalkTrace 2; -* no-capture-flag *-
groebnerWalk(gb I1, R2)
SeeAlso
groebnerWalk
Expand Down Expand Up @@ -596,7 +596,7 @@ Description
down the computation, and is not recommended except for testing.
Example
getWalkTrace()
setWalkTrace 2;
setWalkTrace 2; -* no-capture-flag *-
getWalkTrace()
SeeAlso
groebnerWalk
Expand Down
6 changes: 3 additions & 3 deletions M2/Macaulay2/packages/LatticePolytopes.m2
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ toricBlowUp(Polyhedron,Polyhedron,ZZ) := (P,F,k) -> (
and contains(e,(facesAsPolyhedra((dim F),F))_0)
));
pt := k * matrix{(vertices Edges_i)_0+(vertices Edges_i)_1-2*(vertices F)_0}*(1/(#latticePoints(Edges_i)-1))+matrix((vertices F)_0);
return intersection(A||E,b||(E*pt)));
polyhedronFromHData(A||E,b||(E*pt)));



Expand Down Expand Up @@ -685,9 +685,9 @@ iskCayleykEdges(Polyhedron):=P->(
if length(L)==2 then(
k:=(L_1-L_0)/gcd(flatten entries(A^{i}));
if k==minLen then(
H0:=intersection(A^{i}||-A^{i},matrix{{L_0},{-L_0}});
H0:=polyhedronFromHData(A^{i}||-A^{i},matrix{{L_0},{-L_0}});
P0=intersection(P,H0);
H1:=intersection(A^{i}||-A^{i},matrix{{L_1},{-L_1}});
H1:=polyhedronFromHData(A^{i}||-A^{i},matrix{{L_1},{-L_1}});
P1=intersection(P,H1);
boolean=false;
);
Expand Down
2 changes: 1 addition & 1 deletion M2/Macaulay2/packages/Macaulay2Doc/functions/check-doc.m2
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Node

For example, to run the tests for the @TO "FirstPackage::FirstPackage"@ package, use:
Example
needsPackage "FirstPackage" -* no-capture-flag *-
needsPackage "FirstPackage"
check_1 FirstPackage
check FirstPackage
Text
Expand Down
2 changes: 1 addition & 1 deletion M2/Macaulay2/packages/Msolve.m2
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ Node
Example
R = QQ[x,y,z]
I = ideal(x, y, z)
msolveGB(I, Verbosity => 2, Threads => 6)
msolveGB(I, Verbosity => 2, Threads => 6) -* no-capture-flag *-
References
[1] The msolve library: @HREF {"https://msolve.lip6.fr"}@;

Expand Down
2 changes: 1 addition & 1 deletion M2/Macaulay2/packages/NumericalSchubertCalculus/doc.m2
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ document{
"setVerboseLevel 0;",
"S = solveSchubertProblem(SchPblm,2,4)",
"assert all(S,s->checkIncidenceSolution(s,SchPblm))",
"setVerboseLevel 1;",
"setVerboseLevel 1; -* no-capture-flag *-",
"S = solveSchubertProblem(SchPblm,2,4)",
"assert all(S,s->checkIncidenceSolution(s,SchPblm))"
},
Expand Down
2 changes: 1 addition & 1 deletion M2/Macaulay2/packages/Python/doc.m2
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ doc ///
@TO "toPython"@.
Example
math = import "math"
setattr(math, "pi", 22/7)
setattr(math, "pi", 22/7) -* no-capture-flag *-
math@@pi
Text
As with @TO "getattr"@, when using the shortcut @TT "\@\@"@, @TT "y"@
Expand Down
4 changes: 2 additions & 2 deletions M2/Macaulay2/packages/RandomMonomialIdeals.m2
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,7 @@ doc ///
using the function writeSample.
This shows how to retrieve that stored sample and have it loaded as an object of type Sample:
Example
writeSample(sample(ER(2,3,0.1),5), "testDirectory")
writeSample(sample(ER(2,3,0.1),5), "testDirectory") -* no-capture-flag *-
mySample = sample("testDirectory")
peek mySample
SeeAlso
Expand Down Expand Up @@ -1846,7 +1846,7 @@ doc ///
about the model used to generate the sample, and another text file contains the
information about the sample itself.
Example
writeSample(sample(ER(2,3,0.1),5), "testDirectory")
writeSample(sample(ER(2,3,0.1),5), "testDirectory") -* no-capture-flag *-
mySample = sample("testDirectory")
peek mySample
SeeAlso
Expand Down
4 changes: 2 additions & 2 deletions M2/Macaulay2/packages/Tableaux/documentation.m2
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Description
The inner shape may be drawn by calling drawInnerShape.
Example
T'' = skewTableau(new Partition from {5,4,-1}, new Partition from {2,4,-3})
drawInnerShape true
drawInnerShape true -* no-capture-flag *-
T''
drawInnerShape false
T''
Expand Down Expand Up @@ -420,7 +420,7 @@ Description
Text
The number of rows is the same as largest part in its shape, minus the smallest part in the shape.
Example
drawInnerShape true
drawInnerShape true -* no-capture-flag *-
T = skewTableau(new Partition from {4,3,1}, new Partition from {1,1,1})
numColumns T
Text
Expand Down
4 changes: 2 additions & 2 deletions M2/Macaulay2/packages/XML.m2
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ Node
Description
Example
xmlNewRoot "foo"
xmlDocDump oo
xmlDocDump oo -* no-capture-flag *-
SeeAlso
xmlDocDump
Node
Expand Down Expand Up @@ -613,7 +613,7 @@ Node
xmlAddElement(n,"key")
xmlAddText(oo,"frobble 你好")
n
xmlDocDump n
xmlDocDump n -* no-capture-flag *-
SeeAlso
xmlNewRoot
Node
Expand Down