@@ -921,6 +921,26 @@ def map_deployed_to_devel_using_about(self, to_resources):
921921
922922 return mapped_to_resources
923923
924+ def get_about_file_companions (self , about_path ):
925+ """
926+ Given an ``about_path`` path string to an About file,
927+ get CodebaseResource objects for the companion license
928+ and notice files.
929+ """
930+ about_file_resource = self .about_resources_by_path .get (about_path )
931+ about_file_extra_data = self .about_pkgdata_by_path .get (about_path ).get (
932+ "extra_data"
933+ )
934+
935+ about_file_companion_names = [
936+ about_file_extra_data .get ("license_file" ),
937+ about_file_extra_data .get ("notice_file" ),
938+ ]
939+ about_file_companions = about_file_resource .siblings ().filter (
940+ name__in = about_file_companion_names
941+ )
942+ return about_file_companions
943+
924944 def create_about_packages_relations (self , project ):
925945 """
926946 Create packages using About file package data, if the About file
@@ -932,11 +952,11 @@ def create_about_packages_relations(self, project):
932952
933953 for about_path , mapped_resources in self .mapped_resources_by_aboutpath .items ():
934954 about_file_resource = self .about_resources_by_path [about_path ]
935- package_data = self .about_pkgdata_by_path [about_file_resource . path ]
955+ package_data = self .about_pkgdata_by_path [about_path ]
936956
937957 if not mapped_resources :
938958 error_message_details = {
939- "path" : about_file_resource . path ,
959+ "path" : about_path ,
940960 "package_data" : package_data ,
941961 }
942962 project .add_warning (
@@ -968,12 +988,7 @@ def create_about_packages_relations(self, project):
968988
969989 about_file_resource .update (status = flag .ABOUT_MAPPED )
970990
971- for about_file_resource in self .about_resources_by_path .values ():
972- about_file_companions = (
973- about_file_resource .siblings ()
974- .filter (name__startswith = about_file_resource .name_without_extension )
975- .filter (extension__in = [".LICENSE" , ".NOTICE" ])
976- )
991+ about_file_companions = self .get_about_file_companions (about_path )
977992 about_file_companions .update (status = flag .ABOUT_MAPPED )
978993
979994 return about_purls , mapped_about_resources
0 commit comments