Skip to content
Snippets Groups Projects
Commit a27dd12a6cf7 authored by hugo.monnerie's avatar hugo.monnerie
Browse files

change list_module to python3 script

parent fd1b9ce6d3e8
No related branches found
No related tags found
No related merge requests found
#!/bin/zsh
# TODO change to a pure python3 script installed with setup.py as an entrypoint
#!/usr/bin/env python3
# vim: set shiftwidth=4 softtabstop=4:
# Create the file odoo_modules_list from setup.cfg
# template version 2.7
......@@ -3,8 +2,74 @@
# vim: set shiftwidth=4 softtabstop=4:
# Create the file odoo_modules_list from setup.cfg
# template version 2.7
project_home=$PWD
python3 -B -c "import configparser ; c = configparser.ConfigParser() ; c.read('${project_home}/setup.cfg') ; print(','.join(c.get('odoo_scripts', 'module_list').split()))" > $project_home/odoo_modules_list
import argparse
import configparser
import logging
import os
import subprocess
import sys
import yaml
from .logging import add_verbosity_to_parser, logging_from_verbose
_logger = logging.getLogger(__name__)
__version__ = '1.0.1'
__date__ = '2020-02-26'
__updated__ = '2020-02-26'
def main(argv=None): # IGNORE:C0111
"""Parse arguments and launch conversion
"""
if argv is None:
argv = sys.argv
else:
sys.argv.extend(argv)
program_version = __version__
program_build_date = str(__updated__)
program_version_message = '%%(prog)s %s (%s)' % (
program_version, program_build_date)
program_shortdesc = __doc__.split("\n")[1]
program_license = '''%s
Created by Hugo Monnerie on %s.
Copyright 2020 XCG Consulting. All rights reserved.
Licensed under the MIT License
Distributed on an "AS IS" basis without warranties
or conditions of any kind, either express or implied.
USAGE
''' % (
program_shortdesc,
str(__date__),
)
# Argument parsing
parser = argparse.ArgumentParser(
description=program_license,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument(
'-V', '--version', action='version',
version=program_version_message)
add_verbosity_to_parser(parser)
nmspc = parser.parse_args()
logging_from_verbose(nmspc)
list_modules(nmspc.directory, nmspc.output)
def list_modules():
c = configparser.ConfigParser()
c.read(os.getcwd()+'/setup.cfg')
with open('odoo_modules_list') as odoo_modul_list:
odoo_modul_list.write(','.join(c.get('odoo_scripts', 'module_list').split()))
if __name__ == '__main__':
main()
......@@ -24,6 +24,7 @@
"do_tests=odoo_scripts.do_tests:main",
"docker_build=odoo_scripts.docker_build:main",
"conf2reST=odoo_scripts.conf2reST:main",
"list_modules=odoo_scripts.list_modules:main",
# TODO add all the other python scripts
]
},
......@@ -31,7 +32,6 @@
"docker_build_copy",
"docker_build_clean",
"update_duplicate_sources",
"list_modules",
],
python_requires=">=3.6",
)
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