sweetpea.core.generate.tools.executables module¶
This module makes it easy to set up the Unigen and CryptoMiniSAT executables as needed by Sweetpea. It can also be run as a script.
Note
SweetPea Core only makes use of the automated download of the current system and machine-type’s executables from the latest release. The rest of the code accommodates other use cases and is not strictly necessary, but it took a bit of reading to suss out GitHub’s API so I figured I’d leave it in place for future use if necessary. But perhaps it should be removed at some point.
Using This Module As a Script¶
To use this module as a script, do python executables.py
(specifying the
full path as needed). A number of options are supported:
- -h, --help
Show a help message and exit.
- -d BIN_DIR, --bin-dir BIN_DIR
The directory into which to install the executables.
The default is determined by
appdirs.user_data_dir()
+SweetPea/Executables
.- -s SYSTEM, --system SYSTEM
The target system. Valid options are
None
,Darwin
,Linux
, andWindows
. WhenNone
is given, the system will be automatically deduced byplatform.system()
.The default is
None
.- -m MACHINE, --machine MACHINE
The target machine type. Valid options are
None
,arm64
,x86_64
, andAMD64
. WhenNone
is given, the machine type will be automatically deduced byplatform.machine()
.The default is
None
.- -t TAG, --tag TAG
The sweetpea-org/unigen-exe release tag to target for downloading.
The default is to use the latest available release tag.
- --asset-string
Prints out the asset string for the indicated system+machine combination. This is provided mostly for debugging.
- sweetpea.core.generate.tools.executables.DOWNLOAD_UNIGEN_ENV_VAR = 'UNIGEN_DOWNLOAD_IF_MISSING'¶
The name of the environment variable that can be used to specify whether the bundled executables should be downloaded. The default value is
True
. Valid options are:Download executables if missing
True
,true
,T
,t
,Yes
,yes
,Y
,y
Do not download executables
False
,false
,F
,f
,No
,no
,N
,n
- sweetpea.core.generate.tools.executables.UNIGEN_EXE_ENV_VAR = 'UNIGEN_EXE_DIR'¶
The folder in which executables will be stored if they are going to be downloaded. The default is an automatically generated directory in the user’s data directory as determined by
appdirs.user_data_dir()
.
- sweetpea.core.generate.tools.executables.ensure_executable_available(executable_path, download_if_missing=True)¶
Checks whether a given necessary executable is available and, if not, downloads it (and its companions) automatically.
- Parameters
executable_path (pathlib.Path) –
download_if_missing (bool) –