#NEWLINE# def get_boilerplate( path , project_name ) : #NEWLINE# #INDENT# '\n    Look for a ``.startproject_boilerplate`` file the given path and parse it.\n    \n    Return a list of 3-part tuples, each containing a boilerplate variable,\n    optional description and default value.\n    \n    If no file was found (or no lines contained boilerplate variables), return\n    an empty list.\n    \n    ' #NEWLINE# defaults = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# defaults_path = os . path . join ( path , '.scaffold_defaults' ) #NEWLINE# if os . path . isfile ( defaults_path ) : #NEWLINE# #INDENT# defaults_file = open ( defaults_path , 'r' ) #NEWLINE# for line in defaults_file : #NEWLINE# #INDENT# match = re . match ( '\\s*(\\w+)\\s*(.*)$' , line ) #NEWLINE# if match : #NEWLINE# #INDENT# ( var , default ) = match . groups ( ) #NEWLINE# defaults [ var ] = default #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# boilerplate = [ ] #NEWLINE# boilerplate_path = os . path . join ( path , '.scaffold_boilerplate' ) #NEWLINE# if os . path . isfile ( boilerplate_path ) : #NEWLINE# #INDENT# boilerplate_file = open ( boilerplate_path , 'r' ) #NEWLINE# for line in boilerplate_file : #NEWLINE# #INDENT# match = re . match ( '\\s*(\\w+)\\s*(.*)$' , line ) #NEWLINE# if match : #NEWLINE# #INDENT# ( var , description ) = match . groups ( ) #NEWLINE# default = defaults . get ( var ) #NEWLINE# boilerplate . append ( ( var , description , default ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return boilerplate