-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include Comsol installation found on
PATH
in discovery (#89)
The discovery mechanism was refactored. We are now first looking for Comsol executables, i.e. `comsol.exe` on Windows or `comsol` on Linux and macOS. We can then add to the list of candidates the Comsol executable that the shell would find, if any, i.e. what would be called when running `comsol` in the terminal. This makes discovery more flexible, since that last installation does not necessarily have to be in a default location. So finding it requires no extra configuration other than "adding Comsol to PATH", which the Comsol installer offers as an option (named not exactly like that, but something to that effect). So when there is but this one Comsol installation, MPh should work out of the box, without the need to create symbolic links if that installation is in a non-default location. We retain the possibility of selecting a specific Comsol back-end, for the purpose of running tests/benchmark across versions. If the back-end on the executable search path (a.k.a. the `PATH`) is the same as one of those already found by searching the system (file system on Linux and macOS, the Registry on Windows), then we'll ignore it. To achieve this functionality, we are now starting our search for other Comsol components such as the Java VM from the location of the Comsol executable, i.e. `comsol.exe` or the `comsol` shell script. We then look for `comsol.ini` in the same folder and parse it in order to get the relative path to the Java VM.
- Loading branch information
Showing
6 changed files
with
259 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,39 @@ | ||
# Installation | ||
|
||
MPh is [available on PyPI][pypi] and can be readily installed via | ||
```none | ||
MPh is [available on PyPI] and can be readily installed via | ||
``` | ||
pip install MPh | ||
``` | ||
Run `pip uninstall MPh` in order to remove the package from your system. | ||
|
||
Requires [JPype][jpype] for the bridge from Python to [Comsol's | ||
Java API][japi] and [NumPy][numpy] for returning (fast) numerical arrays. | ||
`pip` makes sure the two Python dependencies are installed and adds them | ||
if missing. | ||
Run `pip uninstall MPh` to remove the package from your system. | ||
|
||
Requires [JPype] for the bridge from Python to [Comsol's Java API] | ||
and [NumPy] for returning (fast) numerical arrays. Pip makes sure the | ||
two Python dependencies are installed and adds them if missing. | ||
|
||
Comsol, obviously, you need to license and install yourself. Versions | ||
from Comsol 5.1 onward are expected to work, though only Comsol 5.5 and | ||
newer have been rigorously tested. A separate Java run-time environment | ||
is *not* required as Comsol ships with one already built in. | ||
|
||
On Linux and macOS, Comsol is expected to be found in its respective | ||
default location. On Windows, any custom install location is supported, | ||
as the installer stores that information in the central registry. | ||
Comsol is expected to be installed in the default location suggested by | ||
its installer. Though on Windows, custom locations are also supported, | ||
as the installer stores that information in the central registry, which | ||
MPh looks up. | ||
|
||
Additionally, whichever Comsol installation starts when you run `comsol` | ||
in the console, will be found as well, even if in a custom location. | ||
|
||
If you want to be able to select an alternative Comsol installation via | ||
MPh's API, like by passing the `version` option to {func}`mph.start`, | ||
and that Comsol version happens to be installed in a custom location, | ||
you can [create a symbolic link] in `~/.local` on Linux and in | ||
`~/Application` on macOS. Have it point to the corresponding Comsol | ||
folder and give the link a name that starts with `comsol`. | ||
|
||
Though if, on Linux, you do have Comsol installed in a custom location, | ||
[create a symbolic link][symlink] in `~/.local`, have it point to that | ||
Comsol folder, and give it a name that starts with `comsol`. | ||
|
||
[pypi]: https://pypi.python.org/pypi/mph | ||
[jpype]: https://jpype.readthedocs.io | ||
[japi]: https://comsol.com/documentation/COMSOL_ProgrammingReferenceManual.pdf | ||
[numpy]: https://numpy.org | ||
[symlink]: https://www.howtogeek.com/287014 | ||
[available on PyPI]: https://pypi.python.org/pypi/mph | ||
[JPype]: https://jpype.readthedocs.io | ||
[Comsol's Java API]: https://comsol.com/documentation/COMSOL_ProgrammingReferenceManual.pdf | ||
[NumPy]: https://numpy.org | ||
[create a symbolic link]: https://www.howtogeek.com/287014 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.