MCPcopy Create free account
hub / github.com/boostorg/build / _canSetEmptyEnvironmentVariable

Function _canSetEmptyEnvironmentVariable

v2/test/configuration.py:236–250  ·  view source on GitHub ↗

Unfortunately different OSs (and possibly Python implementations as well) have different interpretations of what it means to set an evironment variable to an empty string. Some (e.g. Windows) interpret it as unsetting the variable and some (e.g. AIX or Darwin) actually set it to a

()

Source from the content-addressed store, hash-verified

234###############################################################################
235
236def _canSetEmptyEnvironmentVariable():
237 """
238 Unfortunately different OSs (and possibly Python implementations as well)
239 have different interpretations of what it means to set an evironment
240 variable to an empty string. Some (e.g. Windows) interpret it as unsetting
241 the variable and some (e.g. AIX or Darwin) actually set it to an empty
242 string.
243
244 """
245 dummyName = "UGNABUNGA_FOO_BAR_BAZ_FEE_FAE_FOU_FAM"
246 original = os.environ.get(dummyName)
247 _env_set(dummyName, "")
248 result = _getExternalEnv(dummyName) == ""
249 _env_set(dummyName, original)
250 return result
251
252
253def _env_del(name):

Callers 1

configuration.pyFile · 0.85

Calls 3

_env_setFunction · 0.85
_getExternalEnvFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected