def git_secrets(): """ Install git secrets if possible. """ if check_is_aws(): # no easy way to install git secrets on ubuntu. return if IS_TRAVIS: # nothing is edited on travis return try: commands = ["git secrets --install", "git secrets --register-aws"] for command in commands: cp = subprocess.run(command.split(" "), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False, check=True) for stream in [cp.stdout, cp.stderr]: if stream: for line in stream.decode().split("\n"): print("*" + line) except subprocess.CalledProcessError as cpe: print(cpe) installed = False for stream in [cpe.stdout, cpe.stderr]: if stream: for line in stream.decode().split("\n"): print("-" + line) if "commit-msg already exists" in line: print("git secrets installed.") installed = True break if not installed: raise execute(*("git secrets --scan".strip().split(" ")))
def config_pythonpath(): """ Add to PYTHONPATH """ if check_is_aws(): env = "DEV" else: env = "MAC" my_env = {'ENV': env, "PIPENV_VERBOSITY": "-1"} for key, value in os.environ.items(): my_env[key] = value my_env["PYTHONPATH"] = my_env.get("PYTHONPATH", "") + MAC_LIBS print(my_env["PYTHONPATH"]) return my_env