import subprocess from importlib import util as importlibutil def module_exists(module_name): return importlibutil.find_spec(module_name) def gitclone(url, targetdir=None): if targetdir: res = subprocess.run(['git', 'clone', url, targetdir], stdout=subprocess.PIPE).stdout.decode('utf-8') else: res = subprocess.run(['git', 'clone', url], stdout=subprocess.PIPE).stdout.decode('utf-8') print(res) def pipi(modulestr): res = subprocess.run(['pip', 'install', modulestr], stdout=subprocess.PIPE).stdout.decode('utf-8') print(res) def pipie(modulestr): res = subprocess.run(['git', 'install', '-e', modulestr], stdout=subprocess.PIPE).stdout.decode('utf-8') print(res) def wget(url, outputdir): res = subprocess.run(['wget', url, '-P', f'{outputdir}'], stdout=subprocess.PIPE).stdout.decode('utf-8') print(res)