# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 from __future__ import print_function import os import shutil TERMINATOR = "\x1b[0m" INFO = "\x1b[1;33m [INFO]: " SUCCESS = "\x1b[1;32m [SUCCESS]: " HINT = "\x1b[3;33m" def copy_files_to(path): filenames = ["samconfig.toml"] for file in filenames: if os.path.isfile(file): shutil.copy(file, path) return True def remove_generated_project(path): if os.path.exists(path): shutil.rmtree(path) else: print(HINT + "Folder {} doesn't exist... aborting clean up".format( path) + TERMINATOR) return True def main(): project_folder = os.getcwd() parent_folder = os.path.abspath(os.path.dirname(project_folder)) if copy_files_to(parent_folder): if remove_generated_project(project_folder): print(SUCCESS + "samconfig template imported!" + TERMINATOR) if __name__ == '__main__': main()