MCPcopy Create free account
hub / github.com/python/cpython / updated_env

Function updated_env

Platforms/emscripten/__main__.py:121–147  ·  view source on GitHub ↗

Create a new dict representing the environment to use. The changes made to the execution environment are printed out.

(updates, emsdk_cache)

Source from the content-addressed store, hash-verified

119
120
121def updated_env(updates, emsdk_cache):
122 """Create a new dict representing the environment to use.
123
124 The changes made to the execution environment are printed out.
125 """
126 env_defaults = {}
127 # https://reproducible-builds.org/docs/source-date-epoch/
128 git_epoch_cmd = ["git", "log", "-1", "--pretty=%ct"]
129 try:
130 epoch = subprocess.check_output(
131 git_epoch_cmd, encoding="utf-8"
132 ).strip()
133 env_defaults["SOURCE_DATE_EPOCH"] = epoch
134 except subprocess.CalledProcessError:
135 pass # Might be building from a tarball.
136 # This layering lets SOURCE_DATE_EPOCH from os.environ takes precedence.
137 environment = env_defaults | get_emsdk_environ(emsdk_cache) | updates
138 env_diff = {}
139 for key, value in environment.items():
140 if os.environ.get(key) != value:
141 env_diff[key] = value
142
143 print("🌎 Environment changes:")
144 for key in sorted(env_diff.keys()):
145 print(f" {key}={env_diff[key]}")
146
147 return environment
148
149
150def subdir(path_key, *, clean_ok=False):

Callers 4

make_emscripten_libffiFunction · 0.70
make_mpdecFunction · 0.70
make_emscripten_pythonFunction · 0.70

Calls 6

get_emsdk_environFunction · 0.85
stripMethod · 0.45
check_outputMethod · 0.45
itemsMethod · 0.45
getMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…