'Creates an environment.  ``base_path`` is used as the current
working directory, and generally where changes are looked for.
``template_path`` is the directory to look for *template*
files, which are files you\'ll explicitly add to the
environment.  This is done with ``.writefile()``.
``script_path`` is the PATH for finding executables.  Usually
grabbed from ``$PATH``.
``environ`` is the operating system environment,
``os.environ`` if not given.
``cwd`` is the working directory, ``base_path`` by default.
If ``start_clear`` is true (default) then the ``base_path``
will be cleared (all files deleted) when an instance is
created.  You can also use ``.clear()`` to clear the files.
``ignore_paths`` is a set of specific filenames that should be
ignored when created in the environment.  ``ignore_hidden``
means, if true (default) that filenames and directories
starting with ``\'.\'`` will be ignored.'

def __init__(self, base_path, template_path=None, script_path=None, environ=None, cwd=None, start_clear=True, ignore_paths=None, ignore_hidden=True):

    self.base_path = base_path
    self.template_path = template_path
    if (environ is None):
        environ = os.environ.copy()
    self.environ = environ
    if (script_path is None):
        if (sys.platform == 'win32'):
            script_path = environ.get('PATH', '').split(';')
        else:
            script_path = environ.get('PATH', '').split(':')
    self.script_path = script_path
    if (cwd is None):
        cwd = base_path
    self.cwd = cwd
    if start_clear:
        self.clear()
    elif (not os.path.exists(base_path)):
        os.makedirs(base_path)
    self.ignore_paths = (ignore_paths or [])
    self.ignore_hidden = ignore_hidden
