Create a new dict representing the environment to use. The changes made to the execution environment are printed out.
(updates, emsdk_cache)
| 119 | |
| 120 | |
| 121 | def 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 | |
| 150 | def subdir(path_key, *, clean_ok=False): |
no test coverage detected
searching dependent graphs…