Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
63 changes: 63 additions & 0 deletions doc/ref/gappkg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,19 @@ The following components of the record are <E>optional</E>.
denoting the other packages which shall be loaded together with the
current package if they are available,
</Item>
<Mark><C>TestPackages</C></Mark>
<Item>
a list of pairs <C>[ pkgname, pkgversion ]</C> of strings,
denoting the packages that are needed only to test the package, but not to
Comment thread
stertooy marked this conversation as resolved.
Outdated
load the package,
</Item>
<Mark><C>NeededSystemPackages</C></Mark>
<Item>
a record whose components describe operating systems or package managers,
e.g. <C>Ubuntu</C> or <C>Homebrew</C>, and whose values are lists of lists
<C>[ syspkgname, ... ]</C>, denoting the system packages needed by the
&GAP; package,
Comment thread
stertooy marked this conversation as resolved.
Outdated
</Item>
<Mark><C>ExternalConditions</C></Mark>
<Item>
a list of strings or of pairs <C>[ text, URL ]</C> of strings,
Expand Down Expand Up @@ -1169,6 +1182,15 @@ In this situation, loading <C>A</C> forces an attempt to load also <C>B</C>,
but <C>A</C> is loaded even if <C>B</C> is not available.
<P/>

If <C>B</C> is not essential for <C>A</C> but is used in the package tests,
(for example because <C>B</C> is a library of groups used to provide
testcases) then the name and the (least) version number of <C>B</C> should
be added to the <C>TestPackages</C> component of the <C>Dependencies</C>
component of the <F>PackageInfo.g</F> file of <C>A</C>. No attempts are made
to actually load <C>B</C>, this should be done explicitly as part of the
package tests.
Comment thread
stertooy marked this conversation as resolved.
Outdated
<P/>

All package dependencies must be documented explicitly in the
<F>PackageInfo.g</F> file. It is important to properly
identify package dependencies and make the right decision
Expand Down Expand Up @@ -1224,6 +1246,47 @@ or what are other ways to disable its loading -->
</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="External dependencies">
<Heading>External Dependencies (System packages needed by a &GAP; Package)</Heading>

<Index>external dependency</Index>
<Index>system package</Index>
<Index Subkey="external">dependencies</Index>
It is possible for a &GAP; package to require external software. If this
software is not bundled together with the package, then this dependency
should be documented. To do so, one either adds a string describing the
Comment thread
stertooy marked this conversation as resolved.
Outdated
dependency, or a list <C>[ description, URL ]</C>, to the
<C>ExternalConditions</C> component of the <C>Dependencies</C> component of
the <F>PackageInfo.g</F> file of the &GAP; package.

<Log><![CDATA[
ExternalConditions := [
[ "needs the PARI/GP computer algebra system Version 2.5 or higher",
"https://pari.math.u-bordeaux.fr/" ]
]
]]></Log>

<P/>
Comment thread
stertooy marked this conversation as resolved.

If this dependency is available through a package manager such as <C>apt</C>
or <C>brew</C>, this should also be documented. This can be done by adding
the system package to the relevant component (such as <C>Ubuntu</C> or
<C>Homebrew</C>) of the <C>NeededSystemPackages</C> component of the
<F>PackageInfo.g</F> file of the &GAP; package. Each system package is added
by means of a list whose first component is the name needed by the package
manager. The other elements of this list are reserved for future usage.

<Log><![CDATA[
NeededSystemPackages := rec(
Ubuntu := [["pari-gp"]],
Homebrew := [["pari"]]
)
]]></Log>
Comment thread
stertooy marked this conversation as resolved.

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Extensions Provided by a Package">
<Heading>Extensions Provided by a Package</Heading>
Expand Down
10 changes: 10 additions & 0 deletions lib/package.gi
Original file line number Diff line number Diff line change
Expand Up @@ -2433,6 +2433,16 @@ InstallGlobalFunction( ValidatePackageInfo, function( info )
l -> IsList( l ) and Length( l ) = 2
and ForAll( l, IsString ) ),
"a list of pairs `[ <pkgname>, <pkgversion> ]' of strings" );
TestOption( record.Dependencies, "TestPackages",
comp -> IsList( comp ) and ForAll( comp,
l -> IsList( l ) and Length( l ) = 2
and ForAll( l, IsString ) ),
"a list of pairs `[ <pkgname>, <pkgversion> ]' of strings" );
TestOption( record.Dependencies, "NeededSystemPackages",
comp -> IsRecord( comp ) and ForAll( RecNames( comp ),
l -> IsList( comp.( l ) ) and ForAll( comp.( l ),
x -> IsList( x ) and IsString( First( x ) ) ) ),
"a record whose values are lists of lists `[ <syspkgname>, ... ]`" );
TestOption( record.Dependencies, "ExternalConditions",
comp -> IsList( comp ) and ForAll( comp,
l -> IsString( l ) or ( IsList( l ) and Length( l ) = 2
Expand Down
Loading