@@ -1066,7 +1066,7 @@ def dumps(self):
10661066
10671067 return saneyaml .dump (data )
10681068
1069- def dump (self , location , android ):
1069+ def dump (self , location ):
10701070 """
10711071 Write formatted ABOUT representation of self to location.
10721072 """
@@ -1087,37 +1087,54 @@ def dump(self, location, android):
10871087 if on_windows :
10881088 about_file_path = add_unc (about_file_path )
10891089
1090- if android :
1091- for lic_key in self .license_key .value :
1090+ with io .open (about_file_path , mode = 'w' , encoding = 'utf-8' ) as dumped :
1091+ dumped .write (genereated_tk_version )
1092+ dumped .write (self .dumps ())
1093+
1094+ def dump_android_notice (self , path , context ):
1095+ """
1096+ Write the NOITCE file consist of copyright, notice and license
1097+ """
1098+ if on_windows :
1099+ path = add_unc (path )
1100+
1101+ with io .open (path , mode = 'w' , encoding = 'utf-8' ) as dumped :
1102+ dumped .write (context )
1103+
1104+ def android_module_license (self , about_parent_path ):
1105+ """
1106+ Create MODULE_LICENSE_XXX which the XXX is the value of license key.
1107+ """
1108+ for lic_key in self .license_key .value :
10921109 # Make uppercase and with dash and spaces and dots replaced by underscore
10931110 # just to look similar and consistent.
10941111 name = 'MODULE_LICENSE_' + lic_key .replace ('.' , '_' ).replace ('-' , '_' ).replace (' ' , '_' ).upper ()
1095- module_lic_path = os .path .join (os . path . dirname ( about_file_path ) , name )
1112+ module_lic_path = os .path .join (about_parent_path , name )
10961113 # Create an empty MODULE_LICESE_XXX file
10971114 open (module_lic_path , 'a' ).close ()
10981115
1099- # Create NOTICE file with the combination context of copyright,
1100- # notice_file and license_file
1101- notice_path = os . path . join ( os . path . dirname ( about_file_path ), 'NOTICE' )
1102- notice_context = ''
1103- if self . copyright . value :
1104- notice_context += self . copyright . value
1105- if self . notice_file . value :
1106- notice_file_dict = self . notice_file . value
1107- notice_file_key = notice_file_dict . keys ()
1108- for key in notice_file_key :
1109- notice_context += ' \n \n ' + notice_file_dict [ key ]
1110- if self .license_file .value :
1111- lic_file_dict = self .license_file .value
1112- lic_file_key = lic_file_dict .keys ()
1113- for key in lic_file_key :
1114- notice_context += '\n \n ' + lic_file_dict [key ]
1115- with io . open ( notice_path , mode = 'w' , encoding = 'utf-8' ) as dumped :
1116- dumped . write ( notice_context )
1117-
1118- with io . open ( about_file_path , mode = 'w' , encoding = 'utf-8' ) as dumped :
1119- dumped . write ( genereated_tk_version )
1120- dumped . write ( self . dumps ())
1116+ def android_notice ( self , about_parent_path ):
1117+ """
1118+ Return a notice dictionary which the path of the notice file going
1119+ to create will be the key and its context will be the value of the dict.
1120+ """
1121+ # Create NOTICE file with the combination context of copyright,
1122+ # notice_file and license_file
1123+ notice_path = posixpath . join ( about_parent_path , 'NOTICE' )
1124+ notice_context = ''
1125+ if self . copyright . value :
1126+ notice_context += self . copyright . value
1127+ if self .notice_file .value :
1128+ notice_file_dict = self .notice_file .value
1129+ notice_file_key = notice_file_dict .keys ()
1130+ for key in notice_file_key :
1131+ notice_context += '\n ' + notice_file_dict [key ] + ' \n '
1132+ if self . license_file . value :
1133+ lic_file_dict = self . license_file . value
1134+ lic_file_key = lic_file_dict . keys ()
1135+ for key in lic_file_key :
1136+ notice_context += ' \n \n ' + lic_file_dict [ key ] + ' \n \n '
1137+ return notice_path , notice_context
11211138
11221139 def dump_lic (self , location , license_dict ):
11231140 """
0 commit comments