Skip to content
Snippets Groups Projects
Commit c5bc520ae788 authored by Vincent Hatakeyama's avatar Vincent Hatakeyama
Browse files

:pencil: include the result of pip freeze in the generated versions.rst file

And stop trying to find version of odoo, it will either not work (like in most cases),
or it will be listed in the pip freeze listing
parent 59716ef5231a
No related branches found
No related tags found
No related merge requests found
2.20 2.21
...@@ -4,6 +4,5 @@ ...@@ -4,6 +4,5 @@
""" """
import argparse import argparse
import ConfigParser import ConfigParser
import csv
import logging import logging
import os import os
...@@ -8,8 +7,9 @@ ...@@ -8,8 +7,9 @@
import logging import logging
import os import os
import subprocess
import sys import sys
import yaml import yaml
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
import sys import sys
import yaml import yaml
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
__version__ = '0.1.0' __version__ = '0.2.0'
__date__ = '2016-07-15' __date__ = '2016-07-15'
...@@ -17,5 +17,5 @@ ...@@ -17,5 +17,5 @@
__date__ = '2016-07-15' __date__ = '2016-07-15'
__updated__ = '2016-07-15' __updated__ = '2019-06-05'
def main(argv=None): # IGNORE:C0111 def main(argv=None): # IGNORE:C0111
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
program_license = '''%s program_license = '''%s
Created by Vincent Hatakeyama on %s. Created by Vincent Hatakeyama on %s.
Copyright 2016 XCG Consulting. All rights reserved. Copyright 2016, 2019 XCG Consulting. All rights reserved.
Licensed under the MIT License Licensed under the MIT License
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
def conf2rst(basedir, directory, output=None): def conf2rst(basedir, directory, output=None):
""" """
:param basedir: directory with the odoo_versions.csv file :param basedir: directory with the odoo_versions.csv file
:param directory: destination directory
:param output: file to write to, else prints in stdout :param output: file to write to, else prints in stdout
""" """
...@@ -90,8 +91,7 @@ ...@@ -90,8 +91,7 @@
parser = ConfigParser.ConfigParser() parser = ConfigParser.ConfigParser()
setup_path = os.path.join(directory, 'setup.cfg') setup_path = os.path.join(directory, 'setup.cfg')
parser.read(setup_path) parser.read(setup_path)
odoo_type = parser.get('odoo_scripts', 'odoo_type', 'odoo8')
addon_dirs = set( addon_dirs = set(
os.path.dirname(path) os.path.dirname(path)
for path in parser.get('odoo_scripts', 'modules').split()) for path in parser.get('odoo_scripts', 'modules').split())
...@@ -94,25 +94,11 @@ ...@@ -94,25 +94,11 @@
addon_dirs = set( addon_dirs = set(
os.path.dirname(path) os.path.dirname(path)
for path in parser.get('odoo_scripts', 'modules').split()) for path in parser.get('odoo_scripts', 'modules').split())
# analyse Dockerfile if any # pip freeze
if 'odoo_type' != 'bzr': reqs = dict()
dockerfile_path = os.path.join(directory, 'Dockerfile') for element in subprocess.check_output(['pip', 'freeze']).split():
with open(dockerfile_path) as dockerfile_file: library, version = element.split('==')
for line in dockerfile_file: reqs[library] = {'version': version}
if line.startswith('FROM '):
dockerbase = line[5:].strip()
_logger.info("Docker base: %s", dockerbase)
# load odoo_version.csv
versions = {}
# add path to script
with open(os.path.join(basedir, 'odoo_versions.csv')) as versions_file:
reader = csv.reader(versions_file, delimiter=',')
for line in reader:
versions[line[0]] = line[1]
if odoo_type != 'bzr':
odoo_version = versions.get(dockerbase, "Unknown")
else:
odoo_version = 'bzr'
_logger.info("Odoo version %s", odoo_version)
rst = { rst = {
...@@ -118,5 +104,5 @@ ...@@ -118,5 +104,5 @@
rst = { rst = {
'odoo': {"Odoo": {'version': odoo_version}}, 'python': reqs,
'tools': {}, 'modules': {}, 'other': {}, 'group of modules': {} 'tools': {}, 'modules': {}, 'other': {}, 'group of modules': {}
} }
# load the conf file # load the conf file
...@@ -185,7 +171,7 @@ ...@@ -185,7 +171,7 @@
out.write("Versions\n") out.write("Versions\n")
out.write("========\n\n") out.write("========\n\n")
for group in ('odoo', 'modules', 'group of modules', 'other', 'tools'): for group in ('modules', 'group of modules', 'python', 'other', 'tools'):
if rst.get(group): if rst.get(group):
out.write(".. list-table:: %s\n" % group) out.write(".. list-table:: %s\n" % group)
out.write(" :widths: 2 3\n") out.write(" :widths: 2 3\n")
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# #
# - access to pg database # - access to pg database
# #
# Version 2.20 # Version 2.21
here=$(dirname $0) here=$(dirname $0)
project_home=$(cd $here && cd .. && echo $PWD) project_home=$(cd $here && cd .. && echo $PWD)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
isort:skip_file isort:skip_file
""" """
# Version 2.20 # Version 2.21
import argparse import argparse
import logging import logging
import os import os
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
isort:skip_file isort:skip_file
""" """
# Version 2.20 # Version 2.21
import argparse import argparse
import datetime import datetime
import json import json
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
isort:skip_file isort:skip_file
""" """
# Version 2.20 # Version 2.21
import argparse import argparse
import atexit import atexit
import glob import glob
......
odoo type,hash
bzr,7.0
xcgd/odoo:7.0,7.0 d246e36c824931613229a6467e21d65d392a2fa3
xcgd/odoo:7.0-test,7.0 a0484cbe45abb5dc393d3229ee1c6d24a4dfae23
xcgd/odoo:8.0,8.0 ba54a668d425c6b2de37428184e788552dc11a1c
xcgd/odoo:8.0-test,8.0 859fe655d295b83d86d5969e301b8f6bcc61c2d1
\ No newline at end of file
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# #
# Either provide the name of the database (first argument) or it will default to <project>_test # Either provide the name of the database (first argument) or it will default to <project>_test
# The DB user can be overriden by setting ODOO_SCRIPTS_DB_USER. # The DB user can be overriden by setting ODOO_SCRIPTS_DB_USER.
# Version 2.20 # Version 2.21
here=$(dirname $0) here=$(dirname $0)
project_home=$(cd $here && cd .. && echo $PWD) project_home=$(cd $here && cd .. && echo $PWD)
if ! type python3 > /dev/null; then if ! type python3 > /dev/null; then
......
[bumpversion] [bumpversion]
current_version = 2.20 current_version = 2.21
parse = (?P<major>\d+)\.(?P<minor>\d+) parse = (?P<major>\d+)\.(?P<minor>\d+)
serialize = serialize =
{major}.{minor} {major}.{minor}
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# #
# You can set ODOO_DATA_DIR and ODOO_DB_HOST if you want to avoid using the default value ($HOME/var/tmp and localhost) # You can set ODOO_DATA_DIR and ODOO_DB_HOST if you want to avoid using the default value ($HOME/var/tmp and localhost)
# #
# Version 2.20 # Version 2.21
here=$(dirname $0) here=$(dirname $0)
project_home=$(cd $here && cd .. && echo $PWD) project_home=$(cd $here && cd .. && echo $PWD)
if [ -x "$(command -v python3)" ]; if [ -x "$(command -v python3)" ];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment