Macaulay2 » Documentation
Packages » Macaulay2Doc > The Macaulay2 language > packages > installPackage
next | previous | forward | backward | up | index | toc

installPackage -- load and install a package and its documentation

Synopsis

Description

The main action of this routine is to generate the documentation of the given package and install the Macaulay2 package and documentation.

The actual file loaded is PackageName.m2, which should be on the load path and should contain a package named PackageName.

In order to accomplish this, several steps are performed (or bypassed, depending on the values of the optional arguments).

  • load the package, if not already loaded (see loadPackage)
  • determine which help pages have changed since last install
  • run any new or previously failed examples, or all examples, as specified by the RerunExamples option
  • generate the html pages, or not, as specified by the MakeHTML option, for the modified help pages, or all html pages if RemakeAllDocumentation is set to true
  • generate the info pages, or not, as specified by the MakeInfo option
  • install the documentation and package in the location specified by the InstallPrefix option
  • place a link to this html documentation in the file index.html in the user's application directory; see makePackageIndex

The current value of prefixPath is used to determine how to direct documentation hyperlinks; the link will be directed to the appropriate file if one is found by searching the trees referred to by prefixPath. Otherwise, all documentation hyperlinks are relative to positions within a single tree of directories, as describe by Layout.

It might be necessary to run installPackage twice if a package with the same name is already installed: the second installation will redirect the hyperlinks to the freshly installed documentation, because the files will have been installed by the first installation. This applies, for example, to those authors who are developing updates to packages already included with Macaulay2.

The files of the package are placed in subdirectories of the appropriate prefix directory as specified by Layout, depending on the value of the SeparateExec option:

Install paths given SeparateExec => false:

  • share/Macaulay2/PackageName.m2,
  • share/info/PackageName.info,
  • lib/Macaulay2/PackageName/,
  • share/Macaulay2/PackageName/, and
  • share/doc/Macaulay2/PackageName/;

Install paths given SeparateExec => true:

  • common/share/Macaulay2/PackageName.m2,
  • common/share/info/PackageName.info,
  • x86_64-Linux-Ubuntu-22.04/lib/Macaulay2/PackageName/,
  • common/share/Macaulay2/PackageName/, and
  • common/share/doc/Macaulay2/PackageName/.

Note that in the latter case, the paths reflect the type of your machine. In addition, if no errors occurred during running the examples, then an empty file whose name is lib/Macaulay2/PackageName/.installed or x86_64-Linux-Ubuntu-22.04/lib/Macaulay2/PackageName/.installed is created, to signify that installation was completed.

Caveat

Links from html files containing documentation to documentation in another package not yet installed may go to the wrong place, because it is assumed that the package not yet installed will be installed under the same prefix. By contrast, if the other package has already been installed under some prefix occurring in the value of prefixPath, then the correct path will be used. To get two packages installed under different prefixes which refer to each other's documentation correctly, it may be necessary to install one of them twice.

See also

Ways to use installPackage :

For the programmer

The object installPackage is a method function with options.