2018-12-10 00:26:40 -05:00
|
|
|
#!/usr/bin/env python
|
2022-06-15 10:46:55 -04:00
|
|
|
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
2018-12-10 00:26:40 -05:00
|
|
|
#
|
|
|
|
# A script similar to GNU envsubst, but filters out
|
|
|
|
# some CI related variables.
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
2022-06-28 13:00:12 -04:00
|
|
|
def main() -> None:
|
2018-12-10 00:26:40 -05:00
|
|
|
# Sanitize environment variables
|
|
|
|
vars_to_remove = []
|
2018-12-07 09:15:34 -05:00
|
|
|
for var_name in os.environ.keys():
|
2018-12-10 00:26:40 -05:00
|
|
|
if var_name.startswith('CI_'):
|
|
|
|
vars_to_remove.append(var_name)
|
|
|
|
for var_name in vars_to_remove:
|
|
|
|
del os.environ[var_name]
|
|
|
|
|
|
|
|
for line in sys.stdin:
|
|
|
|
if not line:
|
|
|
|
break
|
|
|
|
sys.stdout.write(os.path.expandvars(line))
|
|
|
|
sys.stdout.flush()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|