#NEWLINE# def prepare_files( self , finder , force_root_egg_info = False , bundle = False ) : #NEWLINE# #INDENT# 'Prepare process. Create temp directories, download and/or unpack files.' #NEWLINE# unnamed = list ( self . unnamed_requirements ) #NEWLINE# reqs = list ( self . requirements . values ( ) ) #NEWLINE# while ( reqs or unnamed ) : #NEWLINE# #INDENT# if unnamed : #NEWLINE# #INDENT# req_to_install = unnamed . pop ( 0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# req_to_install = reqs . pop ( 0 ) #NEWLINE# #UNINDENT# install = True #NEWLINE# best_installed = False #NEWLINE# not_found = None #NEWLINE# if ( ( not self . ignore_installed ) and ( not req_to_install . editable ) ) : #NEWLINE# #INDENT# req_to_install . check_if_exists ( ) #NEWLINE# if req . satisfied_by : #NEWLINE# #INDENT# if self . upgrade : #NEWLINE# #INDENT# if ( ( not self . force_reinstall ) and ( not req_to_install . url ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# url = finder . find_requirement ( req_to_install , self . upgrade ) #NEWLINE# #UNINDENT# except BestVersionAlreadyInstalled : #NEWLINE# #INDENT# best_installed = True #NEWLINE# install = False #NEWLINE# #UNINDENT# except DistributionNotFound : #NEWLINE# #INDENT# not_found = sys . exc_info ( ) [ 1 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# req_to_install . url = url . url #NEWLINE# #UNINDENT# #UNINDENT# if ( not best_installed ) : #NEWLINE# #INDENT# if ( not ( self . use_user_site and ( not dist_in_usersite ( req_to_install . satisfied_by ) ) ) ) : #NEWLINE# #INDENT# req_to_install . conflicts_with = req_to_install . satisfied_by #NEWLINE# #UNINDENT# req_to_install . satisfied_by = None #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# install = False #NEWLINE# #UNINDENT# #UNINDENT# if req_to_install . satisfied_by : #NEWLINE# #INDENT# if best_installed : #NEWLINE# #INDENT# logger . notify ( ( 'Requirement already up-to-date: %s' % req_to_install ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . notify ( ( 'Requirement already satisfied (use --upgrade to upgrade): %s' % req_to_install ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if req_to_install . editable : #NEWLINE# #INDENT# logger . notify ( ( 'Obtaining %s' % req_to_install ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if install : #NEWLINE# #INDENT# if ( req_to_install . url and req_to_install . url . lower ( ) . startswith ( 'file:' ) ) : #NEWLINE# #INDENT# logger . notify ( ( 'Unpacking %s' % display_path ( url_to_path ( req_to_install . url ) ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . notify ( ( 'Downloading/unpacking %s' % req_to_install ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# logger . indent += 2 #NEWLINE# try : #NEWLINE# #INDENT# is_bundle = False #NEWLINE# if req_to_install . editable : #NEWLINE# #INDENT# if ( req_to_install . source_dir is None ) : #NEWLINE# #INDENT# location = req_to_install . build_location ( self . src_dir ) #NEWLINE# req_to_install . source_dir = location #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# location = req_to_install . source_dir #NEWLINE# #UNINDENT# if ( not os . path . exists ( self . build_dir ) ) : #NEWLINE# #INDENT# _make_build_dir ( self . build_dir ) #NEWLINE# #UNINDENT# req_to_install . update_editable ( ( not self . is_download ) ) #NEWLINE# if self . is_download : #NEWLINE# #INDENT# req_to_install . run_egg_info ( ) #NEWLINE# req_to_install . archive ( self . download_dir ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# req_to_install . run_egg_info ( ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if install : #NEWLINE# #INDENT# location = req_to_install . build_location ( self . build_dir , ( not self . is_download ) ) #NEWLINE# unpack = True #NEWLINE# url = None #NEWLINE# if ( not os . path . exists ( os . path . join ( location , 'setup.py' ) ) ) : #NEWLINE# #INDENT# if ( req_to_install . url is None ) : #NEWLINE# #INDENT# if not_found : #NEWLINE# #INDENT# raise not_found #NEWLINE# #UNINDENT# url = finder . find_requirement ( req_to_install , upgrade = self . upgrade ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# url = Link ( req_to_install . url ) #NEWLINE# assert url #NEWLINE# #UNINDENT# if url : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . unpack_url ( url , location , self . is_download ) #NEWLINE# #UNINDENT# except HTTPError : #NEWLINE# #INDENT# e = sys . exc_info ( ) [ 1 ] #NEWLINE# logger . fatal ( ( 'Could not install requirement %s because of error %s' % ( req_to_install , e ) ) ) #NEWLINE# raise InstallationError ( ( 'Could not install requirement %s because of HTTP error %s for URL %s' % ( req_to_install , e , url ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# unpack = False #NEWLINE# #UNINDENT# #UNINDENT# if unpack : #NEWLINE# #INDENT# is_bundle = req_to_install . is_bundle #NEWLINE# if is_bundle : #NEWLINE# #INDENT# req_to_install . move_bundle_files ( self . build_dir , self . src_dir ) #NEWLINE# for subreq in req_to_install . bundle_requirements ( ) : #NEWLINE# #INDENT# reqs . append ( subreq ) #NEWLINE# self . add_requirement ( subreq ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if self . is_download : #NEWLINE# #INDENT# req_to_install . source_dir = location #NEWLINE# req_to_install . run_egg_info ( ) #NEWLINE# if ( url and ( url . scheme in vcs . all_schemes ) ) : #NEWLINE# #INDENT# req_to_install . archive ( self . download_dir ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# req_to_install . source_dir = location #NEWLINE# req_to_install . run_egg_info ( ) #NEWLINE# if force_root_egg_info : #NEWLINE# #INDENT# req_to_install . run_egg_info ( force_root_egg_info = True ) #NEWLINE# #UNINDENT# req_to_install . assert_source_matches_version ( ) #NEWLINE# if ( bundle and req_to_install . url ) : #NEWLINE# #INDENT# self . copy_to_build_dir ( req_to_install ) #NEWLINE# install = False #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# req_to_install . check_if_exists ( ) #NEWLINE# if req_to_install . satisfied_by : #NEWLINE# #INDENT# if ( self . upgrade or self . ignore_installed ) : #NEWLINE# #INDENT# if ( not ( self . use_user_site and ( not dist_in_usersite ( req_to_install . satisfied_by ) ) ) ) : #NEWLINE# #INDENT# req_to_install . conflicts_with = req_to_install . satisfied_by #NEWLINE# #UNINDENT# req_to_install . satisfied_by = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# install = False #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( not is_bundle ) : #NEWLINE# #INDENT# finder . add_dependency_links ( req_to_install . dependency_links ) #NEWLINE# if req_to_install . extras : #NEWLINE# #INDENT# logger . notify ( ( 'Installing extra requirements: %r' % ',' . join ( req_to_install . extras ) ) ) #NEWLINE# #UNINDENT# if ( not self . ignore_dependencies ) : #NEWLINE# #INDENT# for req in req_to_install . requirements ( req_to_install . extras ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# name = pkg_resources . Requirement . parse ( req ) . project_name #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# e = sys . exc_info ( ) [ 1 ] #NEWLINE# logger . error ( ( 'Invalid requirement: %r (%s) in requirement %s' % ( req , e , req_to_install ) ) ) #NEWLINE# continue #NEWLINE# #UNINDENT# if self . has_requirement ( name ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# subreq = InstallRequirement ( req , req_to_install ) #NEWLINE# reqs . append ( subreq ) #NEWLINE# self . add_requirement ( subreq ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not self . has_requirement ( req_to_install . name ) ) : #NEWLINE# #INDENT# self . add_requirement ( req_to_install ) #NEWLINE# #UNINDENT# if ( self . is_download or ( req_to_install . _temp_build_dir is not None ) ) : #NEWLINE# #INDENT# self . reqs_to_cleanup . append ( req_to_install ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . reqs_to_cleanup . append ( req_to_install ) #NEWLINE# #UNINDENT# if install : #NEWLINE# #INDENT# self . successfully_downloaded . append ( req_to_install ) #NEWLINE# if ( bundle and ( req_to_install . url and req_to_install . url . startswith ( 'file:///' ) ) ) : #NEWLINE# #INDENT# self . copy_to_build_dir ( req_to_install ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# logger . indent -= 2