73.4 Functions for Share Packages

  • DeclarePackage( name, version, tester ) F
  • DeclareAutoPackage( name, version, tester ) F

    This function may only occur within the init.g file of the share package name. It prepares the installation of the package name, which will be installed in version version. The third argument tester is a function which tests for necessary conditions for the package to be loadable, like the availability of other packages (using TestPackageAvailability, see TestPackageAvailability) or -- if necessary -- the existence of compiled binaries. It should return true only if all conditions are fulfilled (and false or fail otherwise). If it does not return true, the package will not be loaded, and the documentation will not be available. The second version DeclareAutoPackage declares the package and enables automatic loading when GAP is started. (Because potentially all installed packages are automatically loaded, the tester function should take little time.)

  • DeclarePackageDocumentation( pkg, doc ) F
  • DeclarePackageAutoDocumentation( pkg, doc ) F

    This function indicates that the documentation of the share package pkg can be found in its doc subdirectory. The second version will enable that the documentation is loaded automatically when GAP starts, even if the package itself will not be loaded. Both functions may only occur within the init.g file of a share package.

  • ReadPkg( pkg, file ) F

    reads the file file of the share package pkg. file is given as a relative path to the directory of pkg.

  • TestPackageAvailability( name, version ) F

    tests, whether the share package name is available for loading in a version that is at least version. It returns true if the package is already loaded, fail if it is not available, and the directory path to the package if it is available, but not yet loaded. A test function (the third parameter to DeclarePackage) should therefore test for the result of TestPackageAvailability being not equal to fail.

  • DirectoriesPackageLibrary( name[, path] ) F

    takes the name of a share package and locates the library functions of the share package. The default is that the library functions are in the subdirectory lib of the share package's home directory. If this is not the case, then the second argument needs to be present and specify a string that is a path name relative to the home directory of the share package.

    gap> DirectoriesPackageLibrary( "example", "gap" );  
    [ dir("/home/werner/Gap/4.0/pkg/example/gap/") ]
    

    In order to find a subdirectory hierarchy in the package directory you can pass subdirectories in lib separated by '/'. For example, to find the subdirectory m11 in the directory data, use:

    DirectoriesPackageLibrary( "pkgname", "data/m11" )
    

  • DirectoriesPackagePrograms( name ) F

    returns a list of the bin/architecture subdirectories of all packages name where architecture is the architecture on which GAP has been compiled. The directories returned by DirectoriesPackagePrograms is the place where external binaries for the share package name and the current architecture should be located.

    gap> DirectoriesPackagePrograms( "nq" );    
    [ dir("/home/werner/Gap/4.0/pkg/nq/bin/i686-unknown-linux2.0.30-gcc/") ]
    

  • CompareVersionNumbers( supplied, required ) F

    compares two version numbers, given as strings. They are split at non-number characters, the resulting integer lists are compared lexicographically. The routine tests, whether supplied is at least as large as required and returns true or false accordingly. A version number ending in dev is considered to be infinite. See Section Version Numbers of ``Extending GAP'' for details about version numbers.

    [Top] [Previous] [Up] [Index]

    GAP 4 manual
    February 2000