Guest User

Untitled

a guest
Jan 20th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. import os
  4. import sys
  5. import subprocess
  6.  
  7.  
  8. if len(sys.argv) != 2:
  9. raise RuntimeError("You should provide task name")
  10.  
  11. WORKING_DIR = "/".join(os.path.abspath(__file__).split('/')[:-1])
  12.  
  13.  
  14. os.chdir(WORKING_DIR)
  15.  
  16. if os.path.exists("task"):
  17. rm_process = subprocess.Popen(["rm -rf %s" % (WORKING_DIR + "/task")], shell=True)
  18. rm_process.wait()
  19.  
  20. ln_dir = WORKING_DIR + "/../%s" % sys.argv[1]
  21. if not ln_dir.endswith('/'):
  22. ln_dir += '/'
  23.  
  24. print("moving to " + ln_dir)
  25.  
  26. ln_process = subprocess.Popen(["ln -s %s %s/task" % (ln_dir, WORKING_DIR)], shell=True)
  27. ln_process.wait()
Add Comment
Please, Sign In to add comment