Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- import os
- import sys
- import subprocess
- if len(sys.argv) != 2:
- raise RuntimeError("You should provide task name")
- WORKING_DIR = "/".join(os.path.abspath(__file__).split('/')[:-1])
- os.chdir(WORKING_DIR)
- if os.path.exists("task"):
- rm_process = subprocess.Popen(["rm -rf %s" % (WORKING_DIR + "/task")], shell=True)
- rm_process.wait()
- ln_dir = WORKING_DIR + "/../%s" % sys.argv[1]
- if not ln_dir.endswith('/'):
- ln_dir += '/'
- print("moving to " + ln_dir)
- ln_process = subprocess.Popen(["ln -s %s %s/task" % (ln_dir, WORKING_DIR)], shell=True)
- ln_process.wait()
Add Comment
Please, Sign In to add comment