# -*- coding: utf-8 -*- from random import randint from .docker_api import ( get_all_external_ports, get_internal_ip, run_container, start_container, stop_container, copy_in ) import unicodedata import stringcase import os _ODOO_DEFAULT_PATHS = ('/custom-addons', '') def snakeize_name(name): try: name = unicodedata.normalize('NFKD', name) name = name.encode('ASCII', 'ignore') except TypeError: name = '' name = stringcase.trimcase(name) name = stringcase.lowercase(name) name = stringcase.snakecase(name) return name def check_name_availability(name): full_path = os.path.join('TODO', name) return os.path.exists(full_path) def randomize_port(): ports = [] port = 0 while not check_port_availability(port): port = randint(ports[0], ports[1]) return port def check_port_availability(port): return port not in get_all_external_ports() def make_default_dirs(name): pass def make_config_file(name): pass def create_database(name): pass def copy_database_seed(): pass def restore_database(name): pass def remove_database_seed(): pass def create_container(name, ports): pass def apply_permissions(name): pass def get_internal_ip(name): pass