Ejemplo n.º 1
0
def main():
    log_dir = os.environ['LOG_DIR']
    if not os.path.exists(log_dir):
        os.mkdir(log_dir)
    SUPERVISOR_CONFIG = os.environ.get('SUPERVISOR_CONFIG')
    supervisor_link(SUPERVISOR_CONFIG)
    supervisor_link(rel_path('supervisor-bootstrap.conf'))
    run('supervisord -n')
Ejemplo n.º 2
0
 def __init__(self, loop: asyncio.BaseEventLoop):
     self.static = pathlib.Path(rel_path('../frontend/build', check=False))
     self.loop = loop
     self.app = Starlette(routes=self.routes, on_shutdown=[self.exit])
     self.config = uvicorn.config.Config(self.app, log_config=None, host='0.0.0.0', port=7999)
     self.server = uvicorn.Server(config=self.config)
     self.serve_task = loop.create_task(self.server.serve())
     self.update_task = loop.create_task(self.update_loop())
     self.ws_clients = []
Ejemplo n.º 3
0
def run_traefik(args):
    compose = rel_path('../resources/traefik.compose.yaml')
    print(f'CMD: {args}')
    cmd = ' '.join(args.cmd)

    full_cmd = f'docker-compose -p traefik -f {compose} {cmd}'
    log.debug(f'Run: {full_cmd}')
    code, out, err = succ(full_cmd)
    for line in chain(out, err):
        print(line)
Ejemplo n.º 4
0
#!/usr/bin/env python3
import argparse
import logging
from fan_tools.python import rel_path
from pathlib import Path

logging.basicConfig(level=logging.DEBUG,
                    format='%(asctime)s [%(levelname)s] %(name)s: %(message)s')
log = logging.getLogger('add_dot_files')

TMPL_DIR = rel_path('../templates/')

TEMPLATES = {
    TMPL_DIR / 'editorconfig.tmpl': {
        'path': Path('.editorconfig'),
    },
    TMPL_DIR / 'pyproject.tmpl': {
        'path': Path('pyproject.toml'),
    },
    TMPL_DIR / 'projectile.tmpl': {
        'path': Path('.projectile'),
    },
}


def parse_args():
    parser = argparse.ArgumentParser(description='DESCRIPTION')
    # parser.add_argument('-m', '--mode', default='auto', choices=['auto', 'manual'])
    # parser.add_argument('-l', '--ll', dest='ll', action='store_true', help='help')
    return parser.parse_args()
Ejemplo n.º 5
0
def test_01_rel_path():
    rel_path('./test_rel_path.py', check=True)
    rel_path('../setup.py', check=True)
Ejemplo n.º 6
0
def cpp_module():
    with cd(rel_path('../..')):
        succ('make example.so')
Ejemplo n.º 7
0
 async def _inner():
     yield {
         'incoming': True,
         'data': Path(rel_path('packets/01_in_update.bin')).read_bytes(),
     }
Ejemplo n.º 8
0
def valid_config_path():
    yield rel_path('./cases/valid_config.yml')
Ejemplo n.º 9
0
def png_content():
    with rel_path('./image.png').open('rb') as f:
        yield f.read()