@@ -455,15 +455,15 @@ def _validate(self, *args, **kwargs):
455455 if self .license_notice_text_location :
456456 location = posixpath .join (self .license_notice_text_location , path )
457457 else :
458- # The 'about_resource_path ' should be a joined path with
458+ # The 'about_resource ' should be a joined path with
459459 # the 'about_file_path' and the 'base_dir
460460 if not self .running_inventory and self .about_file_path :
461461 # Get the parent directory of the 'about_file_path'
462462 afp_parent = posixpath .dirname (self .about_file_path )
463463
464- # Create a relative 'about_resource_path' by joining the
464+ # Create a relative 'about_resource' path by joining the
465465 # parent of the 'about_file_path' with the value of the
466- # 'about_resource_path '
466+ # 'about_resource '
467467 arp = posixpath .join (afp_parent , path )
468468 normalized_arp = posixpath .normpath (arp ).strip (posixpath .sep )
469469 location = posixpath .join (self .base_dir , normalized_arp )
@@ -480,7 +480,11 @@ def _validate(self, *args, **kwargs):
480480 location = util .to_posix (location .strip (UNC_PREFIX ))
481481 msg = (u'Field %(name)s: Path %(location)s not found'
482482 % locals ())
483- errors .append (Error (CRITICAL , msg ))
483+ # We want to show INFO error for 'about_resource'
484+ if name == u'about_resource' :
485+ errors .append (Error (INFO , msg ))
486+ else :
487+ errors .append (Error (CRITICAL , msg ))
484488 location = None
485489
486490 paths [path ] = location
@@ -702,10 +706,10 @@ def create_fields(self):
702706 is simpler.
703707 """
704708 self .fields = OrderedDict ([
705- ('about_resource' , ListField (required = True )),
709+ # ('about_resource', ListField(required=True)),
706710 # ('about_resource', AboutResourceField(required=True)),
707- ('name ' , SingleLineField ( )),
708- ('about_resource_path ' , AboutResourceField ( )),
711+ ('about_resource ' , AboutResourceField ( required = True )),
712+ ('name ' , SingleLineField ( required = True )),
709713
710714 ('version' , SingleLineField ()),
711715 ('download_url' , UrlField ()),
@@ -870,6 +874,7 @@ def as_dict(self, with_paths=False, with_absent=True, with_empty=True):
870874 afpa = self .about_file_path_attr
871875 as_dict [afpa ] = self .about_file_path
872876 arpa = self .about_resource_path_attr
877+ """
873878 if self.about_resource_path.present:
874879 as_dict[arpa] = self.resolved_resources_paths()
875880 else:
@@ -890,6 +895,7 @@ def as_dict(self, with_paths=False, with_absent=True, with_empty=True):
890895 key = u''
891896 arp[key] = None
892897 as_dict[arpa] = arp
898+ """
893899
894900 for field in self .all_fields (with_absent = with_absent ,
895901 with_empty = with_empty ):
@@ -1035,12 +1041,12 @@ def load(self, location, use_mapping=False, mapping_file=None):
10351041 yaml .load (input_text , Loader = util .NoDuplicateLoader )
10361042 """
10371043 The running_inventory defines if the current process is 'inventory' or not.
1038- This is used for the validation of the about_resource_path .
1044+ This is used for the validation of the path of the 'about_resource' .
10391045 In the 'inventory' command, the code will use the parent of the about_file_path
1040- location and join with the 'about_resource_path ' for the validation.
1046+ location and join with the 'about_resource ' for the validation.
10411047 On the other hand, in the 'gen' command, the code will use the
10421048 generated location (aka base_dir) along with the parent of the about_file_path
1043- and then join with the 'about_resource_path '
1049+ and then join with the 'about_resource '
10441050 """
10451051 running_inventory = True
10461052 # wrap the value of the boolean field in quote to avoid
@@ -1103,7 +1109,7 @@ def dumps(self, use_mapping=False, mapping_file=False, with_absent=False, with_e
11031109 license_name = []
11041110 license_file = []
11051111 license_url = []
1106- file_fields = ['about_resource_path ' , 'notice_file' , 'changelog_file' , 'author_file' ]
1112+ file_fields = ['about_resource ' , 'notice_file' , 'changelog_file' , 'author_file' ]
11071113 bool_fields = ['redistribute' , 'attribute' , 'track_changes' , 'modified' ]
11081114 for field in self .all_fields (with_absent , with_empty ):
11091115 if field .name == 'license_key' and field .value :
@@ -1114,11 +1120,9 @@ def dumps(self, use_mapping=False, mapping_file=False, with_absent=False, with_e
11141120 license_file = field .value .keys ()
11151121 elif field .name == 'license_url' and field .value :
11161122 license_url = field .value
1117- # No multiple 'about_resource' and 'about_resource_path' reference supported.
1123+ # No multiple 'about_resource' reference supported.
11181124 # Take the first element (should only be one) in the list for the
1119- # value of 'about_resource' and 'about_resource_path'
1120- elif field .name == 'about_resource' and field .value :
1121- about_data [field .name ] = field .value [0 ]
1125+ # value of 'about_resource'
11221126 elif field .name in file_fields and field .value :
11231127 about_data [field .name ] = list (field .value .keys ())[0 ]
11241128 else :
@@ -1373,8 +1377,6 @@ def about_object_to_list_of_dictionary(abouts, with_absent=False, with_empty=Tru
13731377 afp = ad ['about_file_path' ]
13741378 afp = '/' + afp if not afp .startswith ('/' ) else afp
13751379 ad ['about_file_path' ] = afp
1376- if not 'about_resource_path' in ad .keys ():
1377- arp = ad ['about_resource_path' ]
13781380 abouts_dictionary_list .append (ad )
13791381 return abouts_dictionary_list
13801382
0 commit comments