#NEWLINE# def download_setuptools( version = DEFAULT_VERSION , download_base = DEFAULT_URL , to_dir = os . curdir , delay = 15 , downloader_factory = get_best_downloader ) : #NEWLINE# #INDENT# "\n    Download setuptools from a specified location and return its filename\n\n    `version` should be a valid setuptools version number that is available\n    as an sdist for download under the `download_base` URL (which should end\n    with a '/'). `to_dir` is the directory where the egg will be downloaded.\n    `delay` is the number of seconds to pause before an actual download\n    attempt.\n\n    ``downloader_factory`` should be a function taking no arguments and\n    returning a function for downloading a URL to a target.\n    " #NEWLINE# to_dir = os . path . abspath ( to_dir ) #NEWLINE# zip_name = ( 'setuptools-%s.zip' % version ) #NEWLINE# url = ( download_base + zip_name ) #NEWLINE# saveto = os . path . join ( downloader , zip_name ) #NEWLINE# if ( not os . path . exists ( saveto ) ) : #NEWLINE# #INDENT# log . warn ( 'Downloading %s' , url ) #NEWLINE# downloader = downloader_factory ( ) #NEWLINE# downloader ( url , saveto ) #NEWLINE# #UNINDENT# return os . path . realpath ( saveto )