Allow to find Odoo addons from Environment Variables
Project description
Odoo Addons Installer
The purpose of this lib is to watch environment variable and find Odoo extra addons_path.
The addons path can be git
project (private or not, see The protocole and the credential) or local dir.
Install
pip install addons-installer --user
or from our registry
pip install addons-installer --extra-index-url https://gitlab.ndp-systemes.fr/api/v4/projects/319/packages/pypi/simple
or in your requirement.txt
file
Fetch git project
To add a git
extra addons path you need to declare an environment variable ADDONS_GIT_FOO
, where the value is the git project path without the domain.
To specify the domain you need to add a ADDONS_GIT_FOO_SERVER=https://my.custom.git.vcs.com
, by default is https://github.com
by convention.
In fact if you follow the convention you need to stop your configuration here.
See default value and convention if you want to fully customize the git clone
commande that will be generated.
Convention
The branch to fetch ADDONS_GIT_<NAME>_BRANCH
The branch used will be in order of priority:
- The value of
ADDONS_GIT_<NAME>_BRANCH
- The value of
ADDONS_GIT_DEFAULT_BRANCH
exceptADDONS_GIT_<NAME>_BRANCH == "NO_DEFAULT"
- The value of
ODOO_VERSION
environment variable - If
ODOO_PATH
exist then we look in the file$ODOO_PATH/odoo/release.py
and get themajor_version
as value "master"
if none above is valid.
The server (domain name) of your git repository
By default, we use https://github.com
.
You can specify a default domain with ADDONS_GIT_DEFAULT_SERVER
if
you want.
Resolving the value by priority:
- The value of
ADDONS_GIT_<NAME>_SERVER
- The value of
ADDONS_GIT_DEFAULT_SERVER
exceptADDONS_GIT_<NAME>_SERVER == "NO_DEFAULT"
"https://github.com"
if none above is valid
The protocole and the credential
By default addons-installer
will use a public
schema for the url. If the git project is private, you need to change
ADDONS_GIT_<NAME>_PROTOCOLE
to https
. Then you need to add the ADDONS_GIT_<NAME>_HTTPS_LOGIN
and ADDONS_GIT_<NAME>_HTTPS_PASSWORD
environment vars.
The ssh
protocole isn’t supported
:warning: The lib will raise an ValueError
if no credential is provided
Resolving the value by priority:
- The value of
ADDONS_GIT_<NAME>_PROTOCOLE
- The value of
ADDONS_GIT_DEFAULT_PROTOCOLE
exceptADDONS_GIT_<NAME>_PROTOCOLE == "NO_DEFAULT"
"public"
if none above is valid
Resolving the value by priority for credential:
- The value of
ADDONS_GIT_<NAME>_HTTPS_LOGIN
- The value of
ADDONS_GIT_DEFAULT_HTTPS_LOGIN
raise
IllegalValueException
- The value of
ADDONS_GIT_<NAME>_HTTPS_PASSWORD
- The value of
ADDONS_GIT_DEFAULT_HTTPS_PASSWORD
raise
IllegalValueException
The clone path
Allow to specift the path where the project will be cloned. This path can be absolute or not (An absolute path is better for predictable behavior).
~
use the home of the current user.
is your current working directory
Resolving the value by priority:
- The value of
ADDONS_GIT_<NAME>_CLONE_PATH
(take the value as final destination) - The value of
ADDONS_GIT_DEFAULT_CLONE_PATH
. Take the value base root path where to clone. The final value will be$ADDONS_GIT_DEFAULT_CLONE_PATH/<NAME>
. - The os temporary file.
/tmp
if you are under a GNU/Linux system
The pull option
Allow to add git clone
custom option. by default we use --depth=1 --quiet --single-branch
.
The value must be a comma or space separated value. argparse
is used to parse the values.
If you want to fully erase the default value you should use ","
as value.
""
will be handle as False
.
Resolving the value by priority:
- The value of
ADDONS_GIT_<NAME>_PULL_OPTION
- The value of
ADDONS_GIT_DEFAULT_PULL_OPTION
. ExceptADDONS_GIT_<NAME>_SERVER == "NO_DEFAULT"
--depth=1 --quiet --single-branch
if none above is valid
Use local directory
You can add addons-path
in the local filesystem with ADDONS_LOCAL_<NAME>
.
There is only one configuration environment variable, ADDONS_LOCAL_DEFAULT_BASE_PATH
.
ADDONS_LOCAL_DEFAULT_BASE_PATH
allow you to specify the root path to see.
Exemple
In this exemple
/src
|
-- path1
-- path2
/other
|
-- sub
|
-- path3
To include /src/path1
, /src/path2
and /other/sub/path3
you have choice.
Using ADDONS_LOCAL_DEFAULT_BASE_PATH
:
ADDONS_LOCAL_DEFAULT_BASE_PATH="/src"
ADDONS_LOCAL_PATH1="path1"
ADDONS_LOCAL_PATH2="path2"
ADDONS_LOCAL_PATH3="/other/sub/path2"
Without ADDONS_LOCAL_DEFAULT_BASE_PATH
:
ADDONS_LOCAL_PATH1="/src/path1"
ADDONS_LOCAL_PATH2="/src/path2"
ADDONS_LOCAL_PATH3="/other/sub/path2"
ADDONS_GIT_SUBDIR_OF and ADDONS_LOCAL_SUBDIR_OF
TODO: Explain this feat
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for addons_installer-2.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62273c9fcb96fcc4ad94bfcda902ea72627969c98a49de8d249b8d999d4098b5 |
|
MD5 | fb69b0b9ef5f4bb44bdd101f2527f6a3 |
|
BLAKE2b-256 | 286f083a60317210e0b4a97915dab4c3527820b9af122f9c17902df3dbc33908 |