Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
katyukha committed Oct 25, 2022
2 parents 7ddfbd3 + 3016b73 commit 8ddc938
Show file tree
Hide file tree
Showing 11 changed files with 169 additions and 33 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Release Notes

## Release 0.15.0

### Added

- Added new options to `fetch` command:
- `--git-single-branch` could be used to clone repos with single branch options
- `--git-depth-1` could be used to clone repos with option `--depth=1`
- Experimental support of Odoo 16.0


### Fixes

- `flake8-colors` not needed anymore, as flake8 support color output byt default.
- Limit version of `pylint-odoo` to less then 8.0 for backward compatibility.
This is done because OCA remove a large part of functionality in 8.0.
See merge request: https://github.com/OCA/pylint-odoo/pull/396

---

## Release 0.14.1 (2022-09-09)

### Fixes
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ The canonical source of odoo-helper-scripts is hosted on [GitLab](https://gitlab
- *13.0*
- *14.0*
- *15.0*
- *16.0* (**experimental**)
- OS support:
- On *Ubuntu* should work nice (auto tested on *Ubuntu 18.04, 20.04*)
- Also should work on *Debian* based systems, but some troubles may happen with installation of system dependencies.
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ If you have any routine operation that you would like to automate with odoo-help
- *13.0*
- *14.0*
- *15.0*
- *16.0* (**experimental**)
- OS support:
- On *Ubuntu* should work nice
- Also should work on *Debian* based systems, but some troubles may happen with installation of system dependencies.
Expand Down
5 changes: 5 additions & 0 deletions lib/ci.bash
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,11 @@ function ci_do_forwardport {
local migration_dst_prefix="$addon_path/migrations/$dst_branch.";
for migration_src in "$migration_src_prefix"*; do
local migration_name=${migration_src#"$migration_src_prefix"};
if [[ "$migration_name" == "0.0.0" ]]; then
# We do not need to forward port odoo serie specific
# migrations.
continue;
fi

local migration_dst=${migration_dst_prefix}${migration_name};
if [ -d "$migration_src" ] && [ ! -d "${migration_dst}" ]; then
Expand Down
1 change: 0 additions & 1 deletion lib/default_config/flake8.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ exclude =
statistics = True
show_source = True
count = True
format = ${cyan}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} %(text)s
40 changes: 31 additions & 9 deletions lib/fetch.bash
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ function fetch_clone_repo_git {
fi

# TODO: Add support for cloning repos with depth=1
if [ -n "$ODOO_HELPER_FETCH_GIT_DEPTH_1" ]; then
git_clone_opt="$git_clone_opt --depth=1";
fi

[ -z "$VERBOSE" ] && git_clone_opt="$git_clone_opt -q "
git_cmd="git $extra_git_opt clone --recurse-submodules $git_clone_opt $repo_url $repo_dest";
Expand Down Expand Up @@ -401,22 +404,35 @@ function fetch_module {
$SCRIPT_NAME fetch --requirements <requirements file>
Options:
-r|--repo <repo> - git repository to get module from
--github <user/repo> - allows to specify repository located on github in short format
--oca <repo name> - allows to specify Odoo Comunity Association module in simpler format
--odoo-app <app_name> - [experimental] fetch module from Odoo Apps Market.
-r|--repo <repo> - Git repository to get module from
--github <user/repo> - Allows to specify repository located on github in short format
--oca <repo name> - Allows to specify Odoo Comunity Association module in simpler format
--git-single-branch - Clone git repositories with '--single-branch' options.
This could make clonning faster and use less space.
Suitable for server installations.
--git-depth-1 - Clone git repositories with '--depth=1' option.
This option could signifiantly reduce size of large git
repositories and download speed. But as drawback, it
does not suit well for development, because it could be difficult
to push changes back to repository.
But, it should be helpful in case of using docker to reduce
size of resulting docker image and faster build.
--odoo-app <app_name> - [experimental] Fetch module from Odoo Apps Market.
Works only for free modules.
-m|--module <module> - module name to be fetched from repository
-n|--name <repo name> - repository name. this name is used for directory to clone repository in.
-m|--module <module> - Module name to be fetched from repository
-n|--name <repo name> - Repository name. this name is used for directory to clone repository in.
Usualy not required
-b|--branch <branch> - name fo repository branch to clone
--requirements <file> - path to requirements file to fetch required modules
-b|--branch <branch> - Name fo repository branch to clone
--requirements <file> - Path to requirements file to fetch required modules
NOTE: requirements file must end with newline.
Configuration via environment variables:
- ODOO_HELPER_FETCH_GIT_SINGLE_BRANCH - if set then odoo-helper
will use --single-branch
option to clone repo
option to clone repositories
- ODOO_HELPER_FETCH_GIT_DEPTH_1 - if set, the odoo-helper
will user --depth=1 option
to clone repositories
- ODOO_HELPER_FETCH_PIP_AUTO_REQUIREMENTS - if set, then odoo-helper
will process requirements.auto.txt
file in repositories/modules
Expand Down Expand Up @@ -490,6 +506,12 @@ function fetch_module {
REPO_BRANCH=${REPO_BRANCH:-${ODOO_VERSION:-$ODOO_BRANCH}};
shift;
;;
--git-single-branch)
ODOO_HELPER_FETCH_GIT_SINGLE_BRANCH=1;
;;
--git-depth-1)
ODOO_HELPER_FETCH_GIT_DEPTH_1=1;
;;
--odoo-app)
fetch_download_odoo_app "$2";
return;
Expand Down
27 changes: 20 additions & 7 deletions lib/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,11 @@ function install_odoo_py_requirements_for_version {
# We have to use recent version of pyopenssl, because default version (19.0.0)
# is not compatible with openssl in recent versions of ubuntu.
echo "pyopenssl>=21.0.0";
elif [[ "$dependency_stripped" =~ cryptography* ]]; then
# Version of cryptography have to be chooses by pyopenssl,
# thus we have to remove version specification for this module.
# Actual for Odoo 16.0
echo "cryptography"
else
# Echo dependency line unchanged to rmp file
echo "$dependency";
Expand Down Expand Up @@ -699,6 +704,8 @@ function install_build_python_guess_version {
echo "3.8.13";
elif [ -n "$ODOO_VERSION" ] && [ "$(odoo_get_major_version)" -eq 15 ]; then
echo "3.8.13";
elif [ -n "$ODOO_VERSION" ] && [ "$(odoo_get_major_version)" -eq 16 ]; then
echo "3.8.13";
else
echoe -e "${REDC}ERROR${NC}: Automatic detection of python version for odoo ${ODOO_VERSION} is not supported!";
return 1;
Expand Down Expand Up @@ -921,7 +928,6 @@ function install_python_tools {
- pylint-odoo
- coverage
- flake8
- flake8-colors
- websocket-client (required for tests in Odoo 12.0)
- jingtrang
Expand Down Expand Up @@ -960,8 +966,8 @@ function install_python_tools {
shift
done
exec_pip "${pip_options[@]}" install "${pip_install_opts[@]}" \
setproctitle watchdog pylint-odoo coverage \
flake8 flake8-colors websocket-client jingtrang;
setproctitle watchdog "pylint-odoo<8.0" coverage \
flake8 websocket-client jingtrang;
}

# Install extra javascript tools
Expand Down Expand Up @@ -1247,6 +1253,7 @@ function install_reinstall_venv {
--build-python-sqlite3 - Apply --enable-loadable-sqlite-extensions
when building python.
";
local odoo_build_py_if_needed;
while [[ $# -gt 0 ]]
do
local key="$1";
Expand All @@ -1267,9 +1274,7 @@ function install_reinstall_venv {
shift;
;;
--build-python-if-needed)
if odoo_ensure_python_version; then
ODOO_BUILD_PYTHON_VERSION=auto;
fi
odoo_build_py_if_needed=1;
;;
--build-python-optimize)
ODOO_BUILD_PYTHON_OPTIMIZE=1;
Expand Down Expand Up @@ -1311,11 +1316,19 @@ function install_reinstall_venv {
echoe -e "${YELLOWC}Removing virualenv...${NC}";
rm -r "$VENV_DIR";
if [ -d "$PROJECT_ROOT_DIR/python" ]; then
rm -r "$PROJECT_ROOT_DIR/python";
rm -rf "$PROJECT_ROOT_DIR/python";
fi
echoe -e "${YELLOWC}Virtualenv removed!${NC}";
fi

# Decide if we need to build python if requested
# This code is placed here, because before checking python version
# we have to remove virtual env first to avoid detection of previously
# installed version.
if [ -n "$odoo_build_py_if_needed" ] && ! odoo_ensure_python_version; then
ODOO_BUILD_PYTHON_VERSION=auto;
fi

# Install odoo
install_odoo_install;

Expand Down
10 changes: 7 additions & 3 deletions lib/odoo.bash
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,11 @@ function odoo_update_sources_archive {
echoe -e "${REDC}ERROR${NC}: Cannot download Odoo. Retry this operation with --verbose option.";
return 1
fi

echoe -e "${LBLUEC}Removing old odoo sources...${NC}";
rm -r "$ODOO_PATH";

if [ -d "$ODOO_PATH" ]; then
echoe -e "${LBLUEC}Removing old odoo sources...${NC}";
rm -r "$ODOO_PATH";
fi

echoe -e "${LBLUEC}Unpacking new source archive ...${NC}";
(cd "$DOWNLOADS_DIR" && \
Expand Down Expand Up @@ -285,6 +287,8 @@ function odoo_ensure_python_version {
${python_interpreter} -c "import sys; assert (3, 6) <= sys.version_info < (3, 10);" > /dev/null 2>&1;
elif [ -n "$ODOO_VERSION" ] && [ "$(odoo_get_major_version)" -eq 15 ]; then
${python_interpreter} -c "import sys; assert (3, 7) <= sys.version_info < (3, 11);";
elif [ -n "$ODOO_VERSION" ] && [ "$(odoo_get_major_version)" -eq 16 ]; then
${python_interpreter} -c "import sys; assert (3, 7) <= sys.version_info < (3, 11);";
else
echoe -e "${REDC}ERROR${NC}: Automatic detection of python version for odoo ${ODOO_VERSION} is not supported!";
return 1;
Expand Down
8 changes: 6 additions & 2 deletions lib/pylib/lodoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,12 @@ def odoo(self):
@property
def dispatch(self):
if self._dispatch is None:
self._dispatch = functools.partial(
self.odoo.http.dispatch_rpc, 'db')
if odoo.release.version_info < (16,):
self._dispatch = functools.partial(
self.odoo.http.dispatch_rpc, 'db')
else:
self._dispatch = functools.partial(
self.odoo.service.dispatch_rpc, 'db')
return self._dispatch

def create_database(self, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion lib/version.bash
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
# Odoo Helper Scripts: Version

# Define version number
ODOO_HELPER_VERSION="0.14.1";
ODOO_HELPER_VERSION="0.15.0";
ODOO_HELPER_CONFIG_VERSION="1";
88 changes: 78 additions & 10 deletions tests/test.bash
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ odoo-helper install js-tools;


# Install oca/partner-contact addons
odoo-helper fetch --oca partner-contact;
odoo-helper fetch --git-single-branch --oca partner-contact;

# Regenerate Ukrainian translations for partner_firstname addons
odoo-helper tr regenerate --lang uk_UA --file uk_UA partner_firstname;
Expand Down Expand Up @@ -397,7 +397,7 @@ odoo-helper-addons-update base

# Fetch OCA account-financial-reporting, which seems to have
# complicated enough dependencies for this test
odoo-helper fetch --oca account-financial-reporting
odoo-helper fetch --git-single-branch --oca account-financial-reporting

# Clone repository explicitly and link it
(cd repositories && \
Expand All @@ -412,7 +412,7 @@ odoo-helper addons update-list

# Generate requirements and fetch them again
odoo-helper addons generate-requirements > /tmp/odoo-requirements.txt
odoo-helper fetch --requirements /tmp/odoo-requirements.txt
odoo-helper fetch --git-single-branch --requirements /tmp/odoo-requirements.txt

# Try to reinstall virtualenv and run server
odoo-helper install reinstall-venv;
Expand Down Expand Up @@ -524,7 +524,7 @@ Fetch OCA/web repo
==================
${NC}"
# Fetch oca/web passing only repo url and branch to fetch command
odoo-helper fetch https://github.com/oca/web --branch 11.0;
odoo-helper fetch https://github.com/oca/web --branch 11.0 --git-single-branch --git-depth-1;

echo -e "${YELLOWC}
============================================
Expand Down Expand Up @@ -881,14 +881,81 @@ odoo-helper addons update-list --tdb;
odoo-helper addons install --tdb --module crm;
odoo-helper addons test-installed crm;

## Reinstall venv without backup and build for python 3.9.7
# Python compiling does not work because conflict with bashcov test coverage util
#odoo-helper install reinstall-venv --no-backup --build-python 3.9.7;
odoo-helper lsd; # List databases

## Install addon website via 'odoo-helper install'
odoo-helper install website;

## Fetch oca/contract
odoo-helper fetch --github crnd-inc/generic-addons

## Install addons from OCA contract
odoo-helper addons install --ual --dir ./repositories/crnd-inc/generic-addons;

## Fetch bureaucrat_helpdesk_lite from Odoo market and try to install it
odoo-helper fetch --odoo-app bureaucrat_helpdesk_lite;
odoo-helper addons install --ual bureaucrat_helpdesk_lite;

#odoo-helper lsd; # List databases
## Print list of installed addons
odoo-helper addons find-installed;

## Run tests for helpdesk lite
odoo-helper test generic_request crnd_wsd

# Drop created databases
odoo-helper db drop odoo15-odoo-test;

echo -e "${YELLOWC}
=================================
Install and check Odoo 16.0 (Py3)
=================================
${NC}"

cd ../;

# Remove odoo 15
# this is needed to bypass gitlab.com limitation of disk space for CI jobs
rm -rf ./odoo-15.0

# Install odoo 16
odoo-helper install sys-deps -y 16.0;

odoo-install --install-dir odoo-16.0 --odoo-version 16.0 \
--http-port 8569 --http-host local-odoo-16 \
--db-user odoo16 --db-pass odoo --create-db-user \
--build-python-if-needed

cd odoo-16.0;

# Install py-tools and js-tools
odoo-helper install py-tools;
odoo-helper install js-tools;

odoo-helper server run --stop-after-init; # test that it runs

# Show project status
odoo-helper status;
odoo-helper server status;
odoo-helper start;
odoo-helper ps;
odoo-helper status;
odoo-helper server status;
odoo-helper stop;

# Show complete odoo-helper status
odoo-helper status --tools-versions --ci-tools-versions;

# Database management
odoo-helper db create --tdb --lang en_US;

odoo-helper addons update-list --tdb;
odoo-helper addons install --tdb --module crm;
odoo-helper addons test-installed crm;

odoo-helper lsd; # List databases

## Install addon website via 'odoo-helper install'
#odoo-helper install website;
odoo-helper install website;

## Fetch oca/contract
#odoo-helper fetch --github crnd-inc/generic-addons
Expand All @@ -907,7 +974,8 @@ odoo-helper addons test-installed crm;
#odoo-helper test generic_request crnd_wsd

# Drop created databases
odoo-helper db drop odoo15-odoo-test;
odoo-helper db drop odoo16-odoo-test;


echo -e "${YELLOWC}
=============================================================
Expand Down

0 comments on commit 8ddc938

Please sign in to comment.