def find_environment_dirs(environment_name=None, data_only=False):
docker.require_images()<EOL>if environment_name is None:<EOL><INDENT>environment_name = '<STR_LIT:.>'<EOL><DEDENT>extension_dir = '<STR_LIT>'<EOL>if validate.valid_name(environment_name) and path.isdir(<EOL>path.expanduser('<STR_LIT>' + environment_name)):<EOL><INDENT>datadir = path.expanduser('<STR_LIT>' + environment_name)<EOL>with open(datadir + '<STR_LIT>') as pd:<EOL><INDENT>srcdir = pd.read()<EOL><DEDENT>if not data_only and not path.exists(srcdir + '<STR_LIT>'):<EOL><INDENT>raise DatacatsError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>return srcdir, extension_dir, datadir<EOL><DEDENT>srcdir = path.abspath(environment_name)<EOL>if not path.isdir(srcdir):<EOL><INDENT>raise DatacatsError('<STR_LIT>')<EOL><DEDENT>wd = srcdir<EOL>oldwd = None<EOL>while not path.exists(wd + '<STR_LIT>'):<EOL><INDENT>oldwd = wd<EOL>wd, _ = path.split(wd)<EOL>if wd == oldwd:<EOL><INDENT>raise DatacatsError(<EOL>'<STR_LIT>'.format(srcdir))<EOL><DEDENT><DEDENT>srcdir = wd<EOL>if oldwd:<EOL><INDENT>_, extension_dir = path.split(oldwd)<EOL><DEDENT>return srcdir, extension_dir, None<EOL>
:param environment_name: exising environment name, path or None to
    look in current or parent directories for project

returns (srcdir, extension_dir, datadir)

extension_dir is the  name of extension directory user was in/referenced,
default: 'ckan'. This value is used by the paster cli command.

datadir will be None if environment_name was a path or None (not a name)