#NEWLINE# def clone_virtualenv( src_dir , dst_dir ) : #NEWLINE# #INDENT# if ( not os . path . exists ( v_sys ) ) : #NEWLINE# #INDENT# raise UserError ( ( 'src dir %r does not exist' % src_dir ) ) #NEWLINE# #UNINDENT# if os . path . exists ( dst_dir ) : #NEWLINE# #INDENT# raise UserError ( ( 'dest dir %r exists' % dst_dir ) ) #NEWLINE# #UNINDENT# logger . info ( ( "cloning virtualenv '%s' => '%s'..." % ( src_dir , dst_dir ) ) ) #NEWLINE# shutil . copytree ( src_dir , dst_dir , symlinks = True , ignore = shutil . ignore_patterns ( '*.pyc' ) ) #NEWLINE# ( version , sys_path ) = _virtualenv_sys ( dst_dir ) #NEWLINE# logger . info ( 'fixing scripts in bin...' ) #NEWLINE# fixup_scripts ( src_dir , dst_dir , version ) #NEWLINE# has_old = ( lambda s : any ( ( i for i in s if _dirmatch ( i , src_dir ) ) ) ) #NEWLINE# if has_old ( sys_path ) : #NEWLINE# #INDENT# logger . info ( 'fixing paths in sys.path...' ) #NEWLINE# fixup_syspath_items ( sys_path , src_dir , dst_dir ) #NEWLINE# #UNINDENT# v_sys = _virtualenv_sys ( dst_dir ) #NEWLINE# remaining = has_old ( v_sys [ 1 ] ) #NEWLINE# assert ( not remaining ) , v_sys #NEWLINE# fix_symlink_if_necessary ( src_dir , dst_dir )