Skip to content

Commit

Permalink
[IMP] Add option to automatically install repo requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
lasley committed Aug 8, 2017
1 parent d77aa24 commit db55e9e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ONBUILD ARG DEPTH_MERGE=100
ONBUILD ARG CLEAN=true
ONBUILD ARG COMPILE=true
ONBUILD ARG CONFIG_BUILD=true
ONBUILD ARG AUTO_REQUIREMENTS=true
ONBUILD ARG PIP_INSTALL_ODOO=true
ONBUILD ARG ADMIN_PASSWORD=admin
ONBUILD ARG SMTP_SERVER=smtp
Expand Down
16 changes: 15 additions & 1 deletion build.d/100-dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
import logging
import os

from odoobaselib import CUSTOM_DIR, FILE_APT_BUILD, SRC_DIR
from odoobaselib import (addons_config,
AUTO_REQUIREMENTS,
CUSTOM_DIR,
FILE_APT_BUILD,
SRC_DIR,
)
from odoobaselib.installer import INSTALLERS


Expand All @@ -20,6 +25,15 @@ for name, class_ in INSTALLERS.items():
class_(req_file).install()


if AUTO_REQUIREMENTS:
for repo in addons_config().keys():
req_file = os.path.join(
SRC_DIR, repo, 'requirements.txt',
)
if os.path.isfile(req_file):
INSTALLERS['pip'](req_file).install()


# Deprecated
req_file = os.path.join(
SRC_DIR, 'requirements.txt',
Expand Down
16 changes: 16 additions & 0 deletions build.d/800-auto-requirements
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python
# Copyright 2017 LasLabs Inc.

import os

import odoobaselib
from odoobaselib.installer import INSTALLERS


if odoobaselib.AUTO_REQUIREMENTS:
for repo in odoobaselib.addons_config().keys():
req_file = os.path.join(
odoobaselib.SRC_DIR, repo, 'requirements.txt',
)
if os.path.isfile(req_file):
INSTALLERS['pip'](req_file).install()
1 change: 1 addition & 0 deletions lib/odoobaselib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
ADDONS_YAML = os.path.join(SRC_DIR, 'addons')
ADDONS_DIR = "/opt/odoo/auto/addons"
CLEAN = os.environ.get("CLEAN") == "true"
AUTO_REQUIREMENTS = os.environ.get("AUTO_REQUIREMENTS") == "true"
LOG_LEVELS = ("DEBUG", "INFO", "WARNING", "ERROR")
FILE_APT_BUILD = os.path.join(
CUSTOM_DIR, 'dependencies', 'apt_build.txt',
Expand Down

0 comments on commit db55e9e

Please sign in to comment.