Installing PyFRAP via setup.py¶
PyFRAP can conveniently be installed via:
python setup.py install
Since PyFRAP requires on I/O of data files that come with it we recommend using:
python setup.py install --user
setuptools comes with multiple installation options, to check them out, type:
python setup.py install --help
PyFRAP has some additional installation options:
Option | Effect |
---|---|
--fiji |
Download and install Fiji during PyFRAP installation. Link Fiji with PyFRAP |
--gmsh |
Download and install Gmsh during PyFRAP installation. Link Gmsh with PyFRAP |
--silent |
Print out less log messages. |
For --fiji
and --gmsh
to work, you need to install wget. To install wget, type:
pip install wget
or if you use the Ananconda distribution:
conda install pywget
PyFRAP setup.py API¶
-
getOptions
()¶ Checks options given to script:
- If
--fiji
is in sys.argv, will set dFiji=1. n - If
--gmsh
is in sys.argv, will set dGmsh=1. - If
--silent
is in sys.argv, will set silent=1.
Note
Makes dGmsh and dFiji global: Not nice but seems easiest way to get options into OverrideInstall.
- If
-
getOpt
(optStr)¶ Checks if optStr is in
sys.argv
. If this is the case, returns 1 and removes it formsys.argv
sosetup.py
will not crash, otherwise returns 0.
-
class
OverrideInstall
(install)¶ Override class subclassing
install
class fromsetuptools
.The Main purpose of this class is to give more possibilities when installing PyFRAP, such as:
- Download Gmsh and enter it automatically into path spec file
- Download Fiji and enter it automatically into path spec file
- Set ownership of data files so that even PyFRAP gets installed as superuser, users will be able to use its full capacities.
Idea taken from here (thanks a bunch!)
-
initOptions
()¶ Parses options into override class.
-
run
()¶ Runs install.
-
addData
()¶ Adds Datafiles to PyFRAP installation.
Makes sure that $USER has proper read/write/execute rights. Note that for Windows it will change rights, since it is not necesary. n Also makes sure that gmsh/Fiji bin ins properly linked.
-
cleanUpExe(fnDL,folderFn,filesBefore,exePath):
Moves it to executables directory and cleans up afterwards.
Parameters: - fnDL (str) – Filename of downloaded file.
- folderFn (str) – Filename of folder containing extracted files.
- filesBefore (list) – Snapshot of
cwd
. - exePath (str) – Path where executables go.
-
downloadGmsh
()¶ Downloads Gmsh, moves it to executables directory and cleans up afterwards.
Note
Only works if
wget
is installed.
-
downloadGmshWin
(arch, gmshVersion)¶ Downloads Gmsh from Gmsh website for Windows
Parameters: - arch (str) – System architecture, e.g. 64/32.
- gmshVersion (str) – gmshVersion String, e.g. 2.12.0 .
Returns: (Donwload filename, Filename of extracted download files)
Return type: (str ,str)
-
downloadGmshOSX
(arch, gmshVersion)¶ Downloads Gmsh from Gmsh website for OSX.
Parameters: - arch (str) – System architecture, e.g. 64/32.
- gmshVersion (str) – gmshVersion String, e.g. 2.12.0 .
Returns: (Donwload filename, Filename of extracted download files)
Return type: (str ,str)
-
downloadGmshLinux
(arch, gmshVersion)¶ Downloads Gmsh from Gmsh website for Linux.
Parameters: - arch (str) – System architecture, e.g. 64/32.
- gmshVersion (str) – gmshVersion String, e.g. 2.12.0 .
Returns: (Donwload filename, Filename of extracted download files)
Return type: (str ,str)
-
makeExeFolder
()¶ Make executables folder if it doesn’t exist yet
-
downloadFiji
()¶ Downloads Gmsh, moves it to executables directory and cleans up afterwards.
Note
Only works if
wget
is installed.
-
downloadFijiLinux
(arch)¶ Downloads Fiji from Fiji website for Linux.
Parameters: arch (str) – System architecture, e.g. 64/32. Returns: (Donwload filename, Filename of extracted download files) Return type: (str ,str)
-
downloadFijiWin
(arch)¶ Downloads Fiji from Fiji website for Windows.
Parameters: arch (str) – System architecture, e.g. 64/32. Returns: (Donwload filename, Filename of extracted download files) Return type: (str ,str)
-
downloadFijiOSX
()¶ Downloads Fiji from Fiji website for OSX.
Returns: (Donwload filename, Filename of extracted download files) Return type: (str ,str)
-
setExePath
(fn, identifier, exePath)¶ Enters executable path into path spec file.
Parameters: - fn (str) – Path to gmsh executable.
- identifier (str) – Identifier in spec file.
- exePath (str) – Path to exe file
-
setGmshPath
(fn)¶ Enters gmsh executable path into path spec file.
Parameters: fn (str) – Path to gmsh executable.
-
setFijiPath
(fn)¶ Enters fiji executable path into path spec file.
Parameters: fn (str) – Path to fiji executable.
-
changePermissions
(filepath, uid, gid, mode)¶ Sets File Permissions.
Parameters: - filepath (str) – Path to file.
- uid (int) – user ID.
- gid (int) – group ID.
- mode (int) – Permission mode.
Returns: True if success
Return type: bool
-
makeAdditionalDataFolders
(folder, fn, uid, gid, mode)¶ Tries to generate additional data folders.
Parameters: - folder (str) – Path to containing folder.
- fn (str) – New folder name
- uid (int) – user ID.
- gid (int) – group ID.
- mode (int) – Permission mode.
Returns: True if success
Return type: bool