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

:sparkles: update python docker requirements to use the API directly rather than using subprocesses

parent 9889f48ee32d
No related branches found
No related tags found
1 merge request!6Topic/default/docker api
......@@ -11,7 +11,7 @@
import hglib
from .config import Config
from .parsing import basic_parser, logging_from_verbose
from .parsing import apply, basic_parser
_logger = logging.getLogger(__name__)
......@@ -52,7 +52,7 @@
"""
parser = __parser()
nmspc = parser.parse_args(argv)
logging_from_verbose(nmspc)
apply(nmspc)
# XXX probably needs an option to indicate path to use, defaulting to
# default
_update_duplicate_sources()
......
# vim: set shiftwidth=4 softtabstop=4:
"""Function to help find a program path
"""
import os
from typing import AnyStr, Optional
def which(program: AnyStr) -> Optional[AnyStr]:
"""Return path of program if it exists
from:
https://stackoverflow.com/questions/377017/test-if-executable-exists-in-python/377028#377028
"""
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
for path in os.environ["PATH"].split(os.pathsep):
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return exe_file
return None
......@@ -5,6 +5,7 @@
PyYAML
coloredlogs
docker
dockerpty
psycopg2
mercurial >=5.2
python-hglib
......@@ -21,7 +21,7 @@
extras_require={
# used to require PyYAML but it is used in import scripts too
"conf2reST": [],
"docker": ["docker"],
"docker": ["docker >=3.4", "dockerpty"],
"import_sql": ["psycopg2"],
"source_control": [
# Only mercurial 5.2 support Python 3.5+
......@@ -39,6 +39,8 @@
"docker_build=odoo_scripts.docker_build:main [docker]",
"docker_build_clean=odoo_scripts.docker_build_clean:main",
"docker_build_copy=odoo_scripts.docker_build_copy:main",
"docker_flake8=odoo_scripts.docker_flake8:main [docker]",
"docker_isort=odoo_scripts.docker_isort:main [docker]",
"conf2reST=odoo_scripts.conf2reST:main [conf2reST]",
"list_modules=odoo_scripts.list_modules:main",
"update_duplicate_sources="
......
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