#NEWLINE# def get_directory_details( path , pbr_version = None ) : #NEWLINE# #INDENT# if ( not sh . isdir ( path ) ) : #NEWLINE# #INDENT# raise IOError ( ( 'Can not detail non-existent directory %s' % path ) ) #NEWLINE# #UNINDENT# with EGGS_DETAILED_LOCK : #NEWLINE# #INDENT# path = sh . abspth ( path ) #NEWLINE# cache_key = ( 'd:%s' % sh . abspth ( path ) ) #NEWLINE# if ( cache_key in EGGS_DETAILED ) : #NEWLINE# #INDENT# return EGGS_DETAILED [ cache_key ] #NEWLINE# #UNINDENT# details = None #NEWLINE# skip_paths = [ sh . joinpths ( path , 'PKG-INFO' ) , sh . joinpths ( path , 'EGG-INFO' ) ] #NEWLINE# skip_paths . extend ( glob . glob ( sh . joinpths ( path , '*.egg-info' ) ) ) #NEWLINE# if any ( ( sh . exists ( a_path ) for a_path in pbr_version ) ) : #NEWLINE# #INDENT# details = pkginfo . Develop ( path ) #NEWLINE# #UNINDENT# if ( ( not details ) or ( not details . name ) ) : #NEWLINE# #INDENT# cmd = [ sys . executable , 'setup.py' , 'egg_info' ] #NEWLINE# if pbr_version : #NEWLINE# #INDENT# env_overrides = { #NEWLINE# #INDENT# 'PBR_VERSION' : str ( pbr_version ) , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# env_overrides = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# sh . execute ( cmd , cwd = path , env_overrides = env_overrides ) #NEWLINE# details = pkginfo . get_metadata ( path ) #NEWLINE# #UNINDENT# if ( ( not details ) or ( not details . name ) ) : #NEWLINE# #INDENT# raise RuntimeError ( ( "No egg detail information discovered at '%s'" % path ) ) #NEWLINE# #UNINDENT# egg_details = { #NEWLINE# #INDENT# 'req' : create_requirement ( details . name , version = details . version ) , #NEWLINE# #UNINDENT# } #NEWLINE# for attr_name in [ 'description' , 'author' , 'version' , 'name' , 'summary' ] : #NEWLINE# #INDENT# egg_details [ attr_name ] = getattr ( details , attr_name ) #NEWLINE# #UNINDENT# for attr_name in [ 'description' , 'author' , 'summary' ] : #NEWLINE# #INDENT# attr_value = egg_details [ attr_name ] #NEWLINE# if isinstance ( attr_value , six . text_type ) : #NEWLINE# #INDENT# egg_details [ attr_name ] = attr_value . encode ( 'ascii' , errors = 'replace' ) #NEWLINE# #UNINDENT# #UNINDENT# LOG . debug ( "Extracted '%s' egg detail information:" , path ) #NEWLINE# utils . log_object ( egg_details , logger = LOG , level = logging . DEBUG ) #NEWLINE# EGGS_DETAILED [ cache_key ] = egg_details #NEWLINE# return egg_details