11#!/usr/bin/env python
22
3+ from __future__ import print_function
34import ast
45import errno
56import os
@@ -25,27 +26,27 @@ def load_config():
2526def try_unlink (path ):
2627 try :
2728 os .unlink (path )
28- except OSError , e :
29+ except OSError as e :
2930 if e .errno != errno .ENOENT : raise
3031
3132def try_symlink (source_path , link_path ):
32- print 'symlinking %s -> %s' % (source_path , link_path )
33+ print ( 'symlinking %s -> %s' % (source_path , link_path ) )
3334 try_unlink (link_path )
3435 try_mkdir_r (os .path .dirname (link_path ))
3536 os .symlink (source_path , link_path )
3637
3738def try_mkdir_r (path ):
3839 try :
3940 os .makedirs (path )
40- except OSError , e :
41+ except OSError as e :
4142 if e .errno != errno .EEXIST : raise
4243
4344def try_rmdir_r (path ):
4445 path = abspath (path )
4546 while path .startswith (install_path ):
4647 try :
4748 os .rmdir (path )
48- except OSError , e :
49+ except OSError as e :
4950 if e .errno == errno .ENOTEMPTY : return
5051 if e .errno == errno .ENOENT : return
5152 raise
@@ -60,14 +61,14 @@ def mkpaths(path, dst):
6061
6162def try_copy (path , dst ):
6263 source_path , target_path = mkpaths (path , dst )
63- print 'installing %s' % target_path
64+ print ( 'installing %s' % target_path )
6465 try_mkdir_r (os .path .dirname (target_path ))
6566 try_unlink (target_path ) # prevent ETXTBSY errors
6667 return shutil .copy2 (source_path , target_path )
6768
6869def try_remove (path , dst ):
6970 source_path , target_path = mkpaths (path , dst )
70- print 'removing %s' % target_path
71+ print ( 'removing %s' % target_path )
7172 try_unlink (target_path )
7273 try_rmdir_r (os .path .dirname (target_path ))
7374
0 commit comments