#NEWLINE# def get_download_urls( self , package_name , version = '' , pkg_type = 'all' ) : #NEWLINE# #INDENT# 'Query PyPI for pkg download URI for a packge' #NEWLINE# if version : #NEWLINE# #INDENT# versions = [ version ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( package_name , versions ) = self . query_versions_pypi ( url ) #NEWLINE# #UNINDENT# all_urls = [ ] #NEWLINE# for ver in versions : #NEWLINE# #INDENT# metadata = self . release_data ( package_name , ver ) #NEWLINE# for urls in self . release_urls ( package_name , ver ) : #NEWLINE# #INDENT# if ( ( pkg_type == 'source' ) and ( urls [ 'packagetype' ] == 'sdist' ) ) : #NEWLINE# #INDENT# all_urls . append ( urls [ 'url' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( pkg_type == 'egg' ) and urls [ 'packagetype' ] . startswith ( 'bdist' ) ) : #NEWLINE# #INDENT# all_urls . append ( urls [ 'url' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( pkg_type == 'all' ) : #NEWLINE# #INDENT# all_urls . append ( urls [ 'url' ] ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( metadata and metadata . has_key ( 'download_url' ) and ( metadata [ 'download_url' ] != 'UNKNOWN' ) and ( metadata [ 'download_url' ] != None ) ) : #NEWLINE# #INDENT# if ( metadata [ 'download_url' ] not in all_urls ) : #NEWLINE# #INDENT# if ( pkg_type != 'all' ) : #NEWLINE# #INDENT# url = filter_url ( pkg_type , metadata [ 'download_url' ] ) #NEWLINE# if url : #NEWLINE# #INDENT# all_urls . append ( url ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return all_urls