Skip to content

Commit

Permalink
script to update py
Browse files Browse the repository at this point in the history
  • Loading branch information
doutriaux1 committed Apr 1, 2020
1 parent 7def9b7 commit bd73896
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions bin/install_amlcs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# install kosh and aml_dmt into current Python
# Sets permission correctly
#!/usr/bin/env python
import os
import shlex
import sys
from subprocess import Popen, PIPE
import argparse

p = argparse.ArgumentParser()

p.add_argument("--no_chmod", action="store_true")
p.add_argument("-v", "--verbose", action="store_true")

args = p .parse_args()

os.chdir(os.path.expanduser("~/git/kosh"))

def run_cmd(cmd, verbose=False):
p = Popen(shlex.split(cmd), stdout=PIPE, stderr=PIPE)
o,e = p.communicate()
if verbose:
print(o.decode("utf-8"))

cmd = "python setup.py install"
run_cmd(cmd, args.verbose)

os.chdir(os.path.expanduser("~/git/data_management_tools"))
run_cmd(cmd, args.verbose)

if args.no_chmod:
print("will not rechmod")
else:
print("Chmoding")
cmd = f"find {sys.prefix}/bin -type f -exec chmod g+rx {{}} +"
run_cmd(cmd, args.verbose)
cmd = f"find {sys.prefix} -type f -exec chmod g+r {{}} +"
run_cmd(cmd, args.verbose)
cmd = f"find {sys.prefix} -type d -exec chmod g+rx {{}} +"
run_cmd(cmd, args.verbose)

0 comments on commit bd73896

Please sign in to comment.