Adding disco_utils.py

pull/112/merge
Adam Letts 2 years ago
parent c870424948
commit b3d2f8ecf9
  1. 24
      disco_utils.py

@ -0,0 +1,24 @@
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)
Loading…
Cancel
Save