1# -*- coding: UTF-8 -*-
2# pylint: disable=wrong-import-position, wrong-import-order
3"""
4Invoke build script.
5Show all tasks with::
6
7    invoke -l
8
9.. seealso::
10
11    * http://pyinvoke.org
12    * https://github.com/pyinvoke/invoke
13"""
14
15from __future__ import absolute_import
16
17# -----------------------------------------------------------------------------
18# BOOTSTRAP PATH: Use provided vendor bundle if "invoke" is not installed
19# -----------------------------------------------------------------------------
20from . import _setup    # pylint: disable=wrong-import-order
21import os.path
22import sys
23INVOKE_MINVERSION = "1.2.0"
24_setup.setup_path()
25_setup.require_invoke_minversion(INVOKE_MINVERSION)
26
27# -----------------------------------------------------------------------------
28# IMPORTS:
29# -----------------------------------------------------------------------------
30import sys
31from invoke import Collection
32
33# -- TASK-LIBRARY:
34from . import _tasklet_cleanup as cleanup
35from . import test
36from . import release
37# DISABLED: from . import docs
38
39# -----------------------------------------------------------------------------
40# TASKS:
41# -----------------------------------------------------------------------------
42# None
43
44
45# -----------------------------------------------------------------------------
46# TASK CONFIGURATION:
47# -----------------------------------------------------------------------------
48namespace = Collection()
49namespace.add_collection(Collection.from_module(cleanup), name="cleanup")
50namespace.add_collection(Collection.from_module(test))
51namespace.add_collection(Collection.from_module(release))
52# -- DISABLED: namespace.add_collection(Collection.from_module(docs))
53namespace.configure({
54    "tasks": {
55        "auto_dash_names": False
56    }
57})
58
59# -- ENSURE: python cleanup is used for this project.
60cleanup.cleanup_tasks.add_task(cleanup.clean_python)
61
62# -- INJECT: clean configuration into this namespace
63namespace.configure(cleanup.namespace.configuration())
64if sys.platform.startswith("win"):
65    # -- OVERRIDE SETTINGS: For platform=win32, ... (Windows)
66    from ._compat_shutil import which
67    run_settings = dict(echo=True, pty=False, shell=which("cmd"))
68    namespace.configure({"run": run_settings})
69else:
70    namespace.configure({"run": dict(echo=True, pty=True)})
71