Configuration
oooscript requires the presence of a configuration file in your project such as config.json.
This configuration file is used to set parameters for oooscript and is generally located in the same directory and your source files.
This is an example from the LibreOffice Python UNO Examples project. See: MESSAGE BOX example.
{
"id": "oooscript",
"name": "message_box",
"app": "WRITER",
"version": "0.1.0",
"args": {
"src_file": "script.py",
"output_name": "msgbox",
"single_script": false,
"clean": true
},
"methods": [
"msg_small",
"msg_long",
"msg_default_yes",
"msg_error",
"msg_warning"
]
}
Configuration Properties
id
Type: string
The id of the configuration. This must always be oooscript
name
Type: string
The name of of the project. This can be any name that suites your project needs. Value is not reflected in the final output.
app
Type: string
This represents the type of LibreOffice application.
Valid values are:
“NONE”
“UNKNOWN”
“WRITER”
“CALC”
“IMPRESS”
“DRAW”
“MATH”
“BASE”
version
Type: string
Version is the oooscript version that configuration is intended for.
The current version of oooscript can be obtained on the command line:
oooscript version
Note
Do not use a version that is greater then the current released version.
methods
Optional. Type: list of string
This is the methods that are exported by your script.
The methods listed there will be the exact methods of g_exportedScripts value.
Note
methods is ignored when single_script is true
methods is necessary when single_script is false or
g_exportedScripts for your script will be empty
args
src_file
Required. Type: string
The source (main) entry point file relative to config file.
This is the python script that LibreOffice will actually see.
output_name
Required. Type: string
The output name of script and/or document.
single_script
Optional. Type: boolean. Default: false
Indicates if the script is a standalone script of has imports.
Standalone scripts must include their own g_exportedScripts value as methods is ignore in this case.
clean
Optional. Type: boolean. Default: true
If true then all doc strings and comments are removed from imported scripts.
include_modules
Optional. Type: list of string
This is a list of modules to include if they are not automatically imported.
{
"args": {
"include_modules": ["greeting", "phaser"]
}
}
See also
exclude_modules
Optional. Type: list of string
List of modules to exclude from project, as regex expressions.
When using some projects such as ooo-dev-tools (OooDev) the package may support working both as a macro and stand alone modes. In such cases there may be dependencies that are needed for standard alone mode that are not required for macro mode.
For instance OooDev uses sphinx and lxml packages for various purposes but these
packages not available in macro mode by default. Also these package are not need to run OooDev in macro mode.
To exclude these package when using OooDev:
{
"args": {
"exclude_modules": ["sphinx\\.*", "lxml\\.*"]
}
}
oooscript by default excludes uno, unohelper, scriptforge, and access2base.
In the unlikely event you would need to override the default excludes of Environment. See: BUILD_EXCLUDE_MODULES.
include_paths
Optional. Type: list of string.
When using include_modules the module you want to include may not be on the current python path. In this case you can use the include_paths to add the path to where your extra modules exist.
See also
See also