Commits

awsum committed a5003b6

update vcprompt install to use temp dirs

Comments (0)

Files changed (1)

 import sh
 import sys
 from collections import defaultdict
+from tempfile import mkdtemp
+from shutil import rmtree
 
 cmds = defaultdict(dict)
 
 
 @target('install','vcprompt')
 def install_vcprompt():
+    #TODO check if ~/bin/vcprompt exists
     env = os.environ.copy()
+    temp_dir = mkdtemp()
     sh.hg.clone('https://bitbucket.org/gward/vcprompt/',
-        '/tmp/vcprompt')
-    sh.make('-C','/tmp/vcprompt')
-    sh.make('-C','/tmp/vcprompt','install','PREFIX=%(HOME)s/opt/vcprompt' % env)
-    sh.ln('-si','%(HOME)s/opt/vcprompt/bin/vcprompt' % env,
+        temp_dir)
+    sh.make('-C', temp_dir)
+    sh.make('-C', temp_dir, 'install', 'PREFIX=%(HOME)s/opt/vcprompt' % env)
+    sh.ln('-s','%(HOME)s/opt/vcprompt/bin/vcprompt' % env,
         '%(HOME)s/bin/vcprompt' % env)
+    rmtree(temp_dir)
+
 
 if __name__ == '__main__':
     import argparse