diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 0000000..7864477 --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,10 @@ +version: '3' +services: + senpy: + image: "${IMAGENAME-gsiupm/senpy}:${VERSION-latest}" + entrypoint: ["/bin/bash"] + working_dir: "/senpy-plugins" + ports: + - 5000:5000 + volumes: + - ".:/usr/src/app/" diff --git a/docker-compose.test.yml b/docker-compose.test.yml new file mode 100644 index 0000000..f60a4cd --- /dev/null +++ b/docker-compose.test.yml @@ -0,0 +1,9 @@ +version: '3' +services: + test: + image: "${IMAGENAME-gsiupm/senpy}:${VERSION-dev}" + entrypoint: ["py.test"] + volumes: + - ".:/usr/src/app/" + command: + [] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7c14358 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3' +services: + senpy: + image: "${IMAGENAME-gsiupm/senpy}:${VERSION-dev}" + build: + context: . + dockerfile: Dockerfile${PYVERSION--2.7} + ports: + - 5001:5000 + volumes: + - "./data:/data" diff --git a/senpy/__main__.py b/senpy/__main__.py index a35f774..9274649 100644 --- a/senpy/__main__.py +++ b/senpy/__main__.py @@ -105,6 +105,12 @@ def main(): action='store_true', default=False, help='Output the senpy version and exit') + parser.add_argument( + '--allow-fail', + '--fail', + action='store_true', + default=False, + help='Do not exit if some plugins fail to activate') args = parser.parse_args() if args.version: print('Senpy version {}'.format(senpy.__version__)) @@ -128,7 +134,7 @@ def main(): sp.install_deps() if args.only_install: return - sp.activate_all() + sp.activate_all(allow_fail=args.allow_fail) if args.only_test: easy_test(sp.plugins(), debug=args.debug) return diff --git a/senpy/extensions.py b/senpy/extensions.py index f3ec2b7..8c97d0f 100644 --- a/senpy/extensions.py +++ b/senpy/extensions.py @@ -318,10 +318,15 @@ class Senpy(object): else: self._default = self._plugins[value.lower()] - def activate_all(self, sync=True): + def activate_all(self, sync=True, allow_fail=False): ps = [] for plug in self._plugins.keys(): - ps.append(self.activate_plugin(plug, sync=sync)) + try: + self.activate_plugin(plug, sync=sync) + except Exception as ex: + if not allow_fail: + raise + logger.error('Could not activate {}: {}'.format(plug, ex)) return ps def deactivate_all(self, sync=True):