OVMS3-idf/tools/ci/envsubst.py
Ivan Grokhotkov 7ecdb1bb27 ci, examples: use sdkconfig.ci as an extra defaults file, if present
- Allows placing CI-specific settings into sdkconfig.ci file
- Allows substituting environment variables in sdkconfig.ci
2018-12-10 16:29:24 +08:00

27 lines
578 B
Python
Executable file

#!/usr/bin/env python
#
# A script similar to GNU envsubst, but filters out
# some CI related variables.
import os
import sys
def main():
# Sanitize environment variables
vars_to_remove = []
for var_name in os.environ.iterkeys():
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()