Skip to content
Snippets Groups Projects
docker_build_copy 1.04 KiB
#!/bin/zsh
# vim: set shiftwidth=4 softtabstop=4:

# Create docker script (copy)

# template version 2.7

# TODO add a way to bypass the value, maybe with a key in the setup.cfg file
project_home=$PWD
static_dir=$project_home/static/
odoo_modules="$(python3 -B -c "import configparser ; c = configparser.ConfigParser() ; c.read('${project_home}/setup.cfg') ; print (c.has_option('odoo_scripts', 'modules') and ' '.join(c.get('odoo_scripts', 'modules').split()) or '')")"

# Copy modules when specified
if [[ -n "$odoo_modules" ]];
then
    if ! [ -x "$(command -v list_modules)" ];
    then
      # TODO test that this works
      $(dirname $0)/list_modules
    else
      list_modules
    fi
    mkdir -p $project_home/odoo_modules
    set -e
    rsync --delete -C --exclude='.hg*' --exclude='.git*' --links --exclude='*.pyc' -r --times $(eval echo $odoo_modules) $project_home/odoo_modules
    # this only sync static from our modules
    rsync --include='/*/static/***' --exclude='/*/*' -r --times --prune-empty-dirs $(eval echo $odoo_modules) $static_dir
fi