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).
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:
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-ArchLinux/lib/Macaulay2/PackageName/.installed is created, to signify that installation was completed.
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.
The object installPackage is a method function with options.