#!/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 here=$(dirname $0) project_home=$(cd $here && cd .. && echo $PWD) if type "python3" > /dev/null; then odoo_modules="$(python3 -B -c "import configparser ; c = configparser.SafeConfigParser() ; c.read('${project_home}/setup.cfg') ; print (c.has_option('odoo_scripts', 'modules') and ' '.join(c.get('odoo_scripts', 'modules').split()) or '')")" else odoo_modules="$(python2 -B -c "import ConfigParser ; c = ConfigParser.SafeConfigParser() ; c.read('${project_home}/setup.cfg') ; print (c.has_option('odoo_scripts', 'modules') and ' '.join(c.get('odoo_scripts', 'modules').split()) or '')")" fi # Copy modules when specified if [[ -n "$odoo_modules" ]]; then if type "python3" > /dev/null; then python3 -B -c "import configparser ; c = configparser.SafeConfigParser() ; c.read('${project_home}/setup.cfg') ; print(','.join(c.get('odoo_scripts', 'module_list').split()))" > $project_home/odoo_modules_list else python2 -B -c "import ConfigParser ; c = ConfigParser.SafeConfigParser() ; c.read('${project_home}/setup.cfg') ; print(','.join(c.get('odoo_scripts', 'module_list').split()))" > $project_home/odoo_modules_list fi mkdir -p $project_home/odoo_modules rsync --delete -C --exclude='.hg*' --exclude='.git*' --links --exclude='*.pyc' -r --times $(eval echo $odoo_modules) $project_home/odoo_modules fi exit $?