Grab the ~/.polyglot/.env file for variables
    If you are running Polyglot v2 on this same machine
    then it should already exist. If not create it.
8554
def init_interface():
    sys.stdout = LoggerWriter(LOGGER.debug)
    sys.stderr = LoggerWriter(LOGGER.error)

    
    warnings.simplefilter('error', UserWarning)
    try:
        load_dotenv(join(expanduser("~") + '/.polyglot/.env'))
    except (UserWarning) as err:
        LOGGER.warning('File does not exist: {}.'.format(join(expanduser("~") + '/.polyglot/.env')), exc_info=True)
        # sys.exit(1)
    warnings.resetwarnings()

    """
    If this NodeServer is co-resident with Polyglot it will receive a STDIN config on startup
    that looks like:
    {"token":"2cb40e507253fc8f4cbbe247089b28db79d859cbed700ec151",
    "mqttHost":"localhost","mqttPort":"1883","profileNum":"10"}
    """

    init = select.select([sys.stdin], [], [], 1)[0]
    if init:
        line = sys.stdin.readline()
        try:
            line = json.loads(line)
            os.environ['PROFILE_NUM'] = line['profileNum']
            os.environ['MQTT_HOST'] = line['mqttHost']
            os.environ['MQTT_PORT'] = line['mqttPort']
            os.environ['TOKEN'] = line['token']
            LOGGER.info('Received Config from STDIN.')
        except (Exception) as err:
            # e = sys.exc_info()[0]
            LOGGER.error('Invalid formatted input. Skipping. %s', err, exc_info=True)
664330
def create_environment(preamble):
    
    environment = copy.deepcopy(os.environ)
    for line in preamble:
        logging.debug(line)
        if "=" in line and not line.startswith("#"):
            tmp = line.split("=")
            key = tmp[0].strip()
            value = tmp[1].strip()
            logging.debug(
                "Found variable {} with value {}".format(key, value))
            environment.update({key: value})
    logging.debug("Env {}".format(environment))
    return environment
9703
def get_or_create_environment(self, repo: str, branch: str, git_repo: Repo, repo_path: Path) -> str:
        
        return str(self.get_or_create_venv(repo_path).resolve() / "bin" / "python")
366174
function extendWithDotEnv(inputEnv, dotEnvPath = '.env') {
    let dotEnvBuffer = null
    try {
        dotEnvBuffer = fs.readFileSync(dotEnvPath)
    } catch (err) {
        if (err.code === 'ENOENT') return inputEnv
        throw err
    }
    const parsed = dotenv.parse(dotEnvBuffer)
    return extend(parsed, inputEnv)
}
1039299
public void addEnv(final Environment.Variable env){
        if(null==envVars) {
            envVars = new ArrayList<Environment.Variable>();
        }
        envVars.add(env);
    }
385420
def make_venv(self, dj_version):
        
        venv_path = self._get_venv_path(dj_version)
        self.logger.info('Creating virtual environment for Django %s ...' % dj_version)
        try:
            create_venv(venv_path, **VENV_CREATE_KWARGS)
        except ValueError:
            self.logger.warning('Virtual environment directory already exists. Skipped.')
        self.venv_install('django==%s' % dj_version, venv_path)
        return venv_path
10774
def getenv(option, default=undefined, cast=undefined):
    

    # We can't avoid __contains__ because value may be empty.
    if option in os.environ:
        value = os.environ[option]
    else:
        if isinstance(default, Undefined):
            raise UndefinedValueError('{} not found. Declare it as envvar or define a default value.'.format(option))

        value = default

    if isinstance(cast, Undefined):
        return value

    if cast is bool:
        value = _cast_boolean(value)
    elif cast is list:
        value = [x for x in value.split(',') if x]
    else:
        value = cast(value)

    return value
476801
def load_dotenv(dotenv_path, verbose=False):
    
    if not os.path.exists(dotenv_path):
        if verbose:
            warnings.warn(f"Not loading {dotenv_path}, it doesn't exist.")
        return None
    for k, v in dotenv_values(dotenv_path).items():
        os.environ.setdefault(k, v)
    return True
215985
def load_dot_env():
    """"""
    if not environments.PIPENV_DONT_LOAD_ENV:
        # If the project doesn't exist yet, check current directory for a .env file
        project_directory = project.project_directory or "."
        dotenv_file = environments.PIPENV_DOTENV_LOCATION or os.sep.join(
            [project_directory, ".env"]
        )

        if os.path.isfile(dotenv_file):
            click.echo(
                crayons.normal(fix_utf8("Loading .env environment variables…"), bold=True),
                err=True,
            )
        else:
            if environments.PIPENV_DOTENV_LOCATION:
                click.echo(
                    "{0}: file {1}={2} does not exist!!\n{3}".format(
                        crayons.red("Warning", bold=True),
                        crayons.normal("PIPENV_DOTENV_LOCATION", bold=True),
                        crayons.normal(environments.PIPENV_DOTENV_LOCATION, bold=True),
                        crayons.red("Not loading environment variables.", bold=True),
                    ),
                    err=True,
                )
        dotenv.load_dotenv(dotenv_file, override=True)
842566
boolean getEnvEquals(String name, String value) {
    return System.getenv().containsKey(name) && System.getenv(name).equals(value);
  }
641347
private function isMultiLangEnvironment()
    {
        // use the multilanguage parameter, if it exists
        if ($this->container->hasParameter('kunstmaan_admin.multi_language')) {
            return $this->container->getParameter('kunstmaan_admin.multi_language');
        }

        // This is a pretty silly implementation.
        // It just checks if it can find _locale in the routing.yml
        $routingFile = file_get_contents($this->rootDir.'/app/config/routing.yml');

        return preg_match('/_locale:/i', $routingFile);
    }
488690
def get_variables
      return unless File.exists?(ENV_FILE)

      File.open(ENV_FILE).each do |line|
        var_name = line.split("=").first
        yield var_name unless line =~ /^\#/
      end
    end
416214
def _check_virtualenv():
    
    from os import waitpid
    from subprocess import Popen, PIPE
    penvs = Popen("source /usr/local/bin/virtualenvwrapper.sh; workon",
                 shell=True, executable="/bin/bash", stdout=PIPE, stderr=PIPE)
    waitpid(penvs.pid, 0)
    envs = penvs.stdout.readlines()
    enverr = penvs.stderr.readlines()
    result = (settings.venv + '\n') in envs and len(enverr) == 0

    vms("Find virtualenv: {}".format(' '.join(envs).replace('\n', '')))
    vms("Find virtualenv | stderr: {}".format(' '.join(enverr)))
    
    if not result:
        info(envs)
        err("The virtualenv '{}' does not exist; can't use CI server.".format(settings.venv))
        if len(enverr) > 0:
            map(err, enverr)
    return result
51766
function isEnv(envAlias) {
  // Check for default case
  if (envAlias === ENV_ALIAS.DEV && Object.keys(env).length === 0) {
    return true;
  }

  return envAlias.some(alias => env[alias]);
}
258511
def _verify_python3_env():
    """"""
    if PY2:
        return
    try:
        import locale
        fs_enc = codecs.lookup(locale.getpreferredencoding()).name
    except Exception:
        fs_enc = 'ascii'
    if fs_enc != 'ascii':
        return

    extra = ''
    if os.name == 'posix':
        import subprocess
        try:
            rv = subprocess.Popen(['locale', '-a'], stdout=subprocess.PIPE,
                                  stderr=subprocess.PIPE).communicate()[0]
        except OSError:
            rv = b''
        good_locales = set()
        has_c_utf8 = False

        # Make sure we're operating on text here.
        if isinstance(rv, bytes):
            rv = rv.decode('ascii', 'replace')

        for line in rv.splitlines():
            locale = line.strip()
            if locale.lower().endswith(('.utf-8', '.utf8')):
                good_locales.add(locale)
                if locale.lower() in ('c.utf8', 'c.utf-8'):
                    has_c_utf8 = True

        extra += '\n\n'
        if not good_locales:
            extra += (
                'Additional information: on this system no suitable UTF-8\n'
                'locales were discovered.  This most likely requires resolving\n'
                'by reconfiguring the locale system.'
            )
        elif has_c_utf8:
            extra += (
                'This system supports the C.UTF-8 locale which is recommended.\n'
                'You might be able to resolve your issue by exporting the\n'
                'following environment variables:\n\n'
                '    export LC_ALL=C.UTF-8\n'
                '    export LANG=C.UTF-8'
            )
        else:
            extra += (
                'This system lists a couple of UTF-8 supporting locales that\n'
                'you can pick from.  The following suitable locales were\n'
                'discovered: %s'
            ) % ', '.join(sorted(good_locales))

        bad_locale = None
        for locale in os.environ.get('LC_ALL'), os.environ.get('LANG'):
            if locale and locale.lower().endswith(('.utf-8', '.utf8')):
                bad_locale = locale
            if locale is not None:
                break
        if bad_locale is not None:
            extra += (
                '\n\nClick discovered that you exported a UTF-8 locale\n'
                'but the locale system could not pick up from it because\n'
                'it does not exist.  The exported locale is "%s" but it\n'
                'is not supported'
            ) % bad_locale

    raise RuntimeError(
        'Click will abort further execution because Python 3 was'
        ' configured to use ASCII as encoding for the environment.'
        ' Consult https://click.palletsprojects.com/en/7.x/python3/ for'
        ' mitigation steps.' + extra
    )
1048590
def generate(env,**kw):
  
  import SCons.Util
  from SCons.Tool.GettextCommon import _detect_msginit
  try:
    env['MSGINIT'] = _detect_msginit(env)
  except:
    env['MSGINIT'] = 'msginit'
  msginitcom = '$MSGINIT ${_MSGNoTranslator(__env__)} -l ${_MSGINITLOCALE}' \
             + ' $MSGINITFLAGS -i $SOURCE -o $TARGET'
  # NOTE: We set POTSUFFIX here, in case the 'xgettext' is not loaded
  #       (sometimes we really don't need it)
  env.SetDefault(
    POSUFFIX = ['.po'],
    POTSUFFIX = ['.pot'],
    _MSGINITLOCALE = '${TARGET.filebase}',
    _MSGNoTranslator = _optional_no_translator_flag,
    MSGINITCOM = msginitcom,
    MSGINITCOMSTR = '',
    MSGINITFLAGS = [ ],
    POAUTOINIT = False,
    POCREATE_ALIAS = 'po-create'
  )
  env.Append( BUILDERS = { '_POInitBuilder' : _POInitBuilder(env) } )
  env.AddMethod(_POInitBuilderWrapper, 'POInit')
  env.AlwaysBuild(env.Alias('$POCREATE_ALIAS'))
625023
@Override
    public void buildEnvironment(Run<?,?> build, EnvVars env) {
        env.put(name,originalFileName);
    }