# Installation to develop ## Basic installation ``` git clone https://gitlab.com/odoo-openupgrade-wizard/odoo-openupgrade-wizard/ cd odoo-openupgrade-wizard virtualenv env --python=python3 . ./env/bin/activate poetry install ``` ``odoo-openupgrade-wizard`` commands are now available in your virutalenv. ## Advanced installation If you want to use this library without installing anything in your system, execute the following steps, otherwise, go to 'Installation' part. 1. Run a docker container: ``docker run -it ubuntu:focal`` 2. Execute the following commnands ``` apt-get update apt-get install git python3 python3-pip python3-venv python3 -m pip install --user pipx python3 -m pipx ensurepath su root pipx install virtualenv pipx install poetry ``` # Run tests ## Via pytest (simple) This will run tests only for the current ``python3.X`` version. (in your virtualenv) ``` poetry run pytest --cov odoo_openupgrade_wizard --verbosity=2 --exitfirst ``` ## Via Tox (advanced) This will run tests for all the python versions put in the ``tox.ini`` folder. (in your virtualenv) ``` tox ``` Note : you should have all the python versions available in your local system. ``` sudo apt-get install python3.6 python3.6-distutils sudo apt-get install python3.7 python3.7-distutils sudo apt-get install python3.8 python3.8-distutils sudo apt-get install python3.9 python3.9-distutils ``` ## Via Gitlab Runner locally ``` # Install tools pipx install gitlabci-local # Run new available command gitlabci-local ``` # Debugging Some docker command could help you when using / developping this tools. **Enter the postgres container** docker exec -it POSTGRES_CONTAINER_NAME /bin/bash # Contribute ## Add python dependencies If you add new dependencies, you have to: - add the reference in the file ``pyproject.toml`` - run the following command in your virtualenv : ``poetry update`` ## Publish on pyPI ``` poetry publish ``` # Understanding the library ## Tools to understand The library is using many tools. It is recommanded to understand that tools to contribute to that project: * Docker (https://www.docker.com/) * Gitlab CI (https://docs.gitlab.com/ee/ci/quick_start/index.html) * openupgrade project (https://github.com/oca/openupgrade) and related openupgradelib (https://github.com/oca/openupgradelib) * poetry (https://python-poetry.org/) * odoorpc (https://github.com/OCA/odoorpc) * git-aggregator (https://github.com/acsone/git-aggregator) Also this project is inspired by the following tools: * click-odoo-contrib (https://github.com/acsone/click-odoo-contrib) # Dockerfile information ### From version 5 to 7 There are no plans to make the tool work for these versions. ### From version 8 to 10 (Python2) Try to create dockerfile, based on the odoo official ones fails. Any help welcome. ### From version 11.0 to latest version. (Python3) The Dockerfile of the version 11 to the lastest version of Odoo are written this way : - Copy the content of https://github.com/odoo/odoo/blob/ODOO_VERSION/setup/package.dfsrc - remove all the part after the big ``apt-get install`` - install debian package ``git`` to have the possibility to pip install from git url. - install custom debian packages - install python odoo requirements - install python ``setuptools-scm`` lib to have the possibility to pip install ``openupgradelib`` from git url. - install python custom requirements - makes link between external user and docker odoo user ## Réferences - how to install gitlab runner locally: https://docs.gitlab.com/runner/install/linux-manually.html - Check your CI locally. (French) https://blog.stephane-robert.info/post/gitlab-valider-ci-yml/ https://blog.callr.tech/building-docker-images-with-gitlab-ci-best-practices/ ## Python version settings depending on the debian version This part can help you if you want to change your autogenerated Dockerfiles. See (https://github.com/odoo/odoo/blob/ODOO_VERSION/setup/package.dfdebian) ### debian:wheezy (V7) (for Odoo: 8.0) - Ubuntu release : 12.04 xxx, 12.10 xxx, 13.04 xxx, 14.10 xxx - python2.7 - First release : 04/05/2013 - End LTS : May 2018 ### debian:jessie (V8) (for Odoo: 9.0, 10.0) - Ubuntu release : 14.04 trusty, 14.10 utopic, 15.04 vivid, 15.10 wily - python2.7 - First release : 26/04/2015 - End LTS : June 2020 ### debian:stretch (V9) (for Odoo: 11.0, 12.0) - Ubuntu releases : 16.04 xenial, 16.10 yakkety, 17.04 zesty, 17.10 artful - python2.7 and python3.5 - First release : 17/06/2017 - End LTS : June 2022 ### debian:buster (13.0, 14.0) - Ubuntu release : 18.04 bionic, 18.10 cosmic, 19.04 disco, 19.10 eoan - python2.7 and python3.7 - First release : 06/07/2019 - End LTS : Undefined. ## debian:bullseye (15.0, 16.0) - Ubuntu release : 20.04 focal, 20.10 groovy, 21.04 hirsute, 21.10 impish - python3.9 - First release : 14/07/2021 - End LTS : Undefined.