#NEWLINE# def parse( self , path = None ) : #NEWLINE# #INDENT# path = ( path or self . requirements_path ) #NEWLINE# path = os . path . abspath ( path ) #NEWLINE# base_directory = os . path . dirname ( path ) #NEWLINE# if ( not os . path . exists ( path ) ) : #NEWLINE# #INDENT# warnings . warn ( 'Requirements file: {} does not exists.' . format ( path ) ) #NEWLINE# return #NEWLINE# #UNINDENT# with open ( path ) as requirements : #NEWLINE# #INDENT# for ( index , line ) in enumerate ( requirements . readlines ( ) ) : #NEWLINE# #INDENT# index += 1 #NEWLINE# line = line . strip ( ) #NEWLINE# if ( not line ) : #NEWLINE# #INDENT# logging . debug ( 'Empty line (line {} from {})' . format ( index , path ) ) #NEWLINE# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if line . startswith ( '#' ) : #NEWLINE# #INDENT# logging . debug ( 'Comments line (line {} from {})' . format ( index , path ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( line . startswith ( '-f' ) or line . startswith ( '--find-links' ) or line . startswith ( '-i' ) or line . startswith ( '--index-url' ) or line . startswith ( '--extra-index-url' ) or line . startswith ( '--no-index' ) ) : #NEWLINE# #INDENT# warnings . warn ( 'Private repos not supported. Skipping.' ) #NEWLINE# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( line . startswith ( '-Z' ) or line . startswith ( '--always-unzip' ) ) : #NEWLINE# #INDENT# warnings . warn ( 'Unused option --always-unzip. Skipping.' ) #NEWLINE# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( line . startswith ( '-r' ) or line . startswith ( '--requirement' ) ) : #NEWLINE# #INDENT# logging . debug ( 'Pining to another requirements file (line {} from {})' . format ( index , path ) ) #NEWLINE# for _line in self . parse ( path = os . path . join ( base_directory , line . split ( ) [ 1 ] ) ) : #NEWLINE# #INDENT# ( yield _line ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( line . startswith ( '-e' ) or line . startswith ( '--editable' ) ) : #NEWLINE# #INDENT# ( yield Requirement . parse ( re . sub ( '^(-e|--editable=?)\\s*' , '' , line ) , editable = True ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logging . debug ( 'Found "{}" (line {} from {})' . format ( line , index , path ) ) #NEWLINE# ( yield Requirement . parse ( line , editable = False ) )