11#!/usr/bin/env python
22# -*- coding: utf8 -*-
33# ============================================================================
4- # Copyright (c) 2013-2017 nexB Inc. http://www.nexb.com/ - All rights reserved.
4+ # Copyright (c) 2013-2018 nexB Inc. http://www.nexb.com/ - All rights reserved.
55# Licensed under the Apache License, Version 2.0 (the "License");
66# you may not use this file except in compliance with the License.
77# You may obtain a copy of the License at
@@ -385,9 +385,6 @@ def _validate(self, *args, **kwargs):
385385 self .base_dir = util .to_posix (self .base_dir )
386386
387387 name = self .name
388- # FIXME: This is a temp fix for #286
389- # The field in ignore_checking_list is validated in the check_file_field_exist function
390- ignore_checking_list = [u'license_file' , u'notice_file' , u'changelog_file' ]
391388
392389 # mapping of normalized paths to a location or None
393390 paths = OrderedDict ()
@@ -416,7 +413,7 @@ def _validate(self, *args, **kwargs):
416413 paths [path ] = location
417414 continue
418415
419- if self .license_notice_text_location and name in ignore_checking_list :
416+ if self .license_notice_text_location :
420417 location = posixpath .join (self .license_notice_text_location , path )
421418 else :
422419 # The 'about_resource_path' should be a joined path with
@@ -442,10 +439,9 @@ def _validate(self, *args, **kwargs):
442439 if not os .path .exists (location ):
443440 # We don't want to show the UNC_PREFIX in the error message
444441 location = util .to_posix (location .strip (UNC_PREFIX ))
445- if not name in ignore_checking_list :
446- msg = (u'Field %(name)s: Path %(location)s not found'
447- % locals ())
448- errors .append (Error (CRITICAL , msg ))
442+ msg = (u'Field %(name)s: Path %(location)s not found'
443+ % locals ())
444+ errors .append (Error (CRITICAL , msg ))
449445 location = None
450446
451447 paths [path ] = location
@@ -1499,45 +1495,3 @@ def verify_license_files_in_location(about, lic_location):
14991495 return license_location_dict , errors
15001496
15011497
1502- def check_file_field_exist (about , location ):
1503- """
1504- Return a list of errors for non-existence file in file fields
1505- """
1506- errors = []
1507- loc = util .to_posix (location )
1508- parent = posixpath .dirname (loc )
1509-
1510- about_file_path = util .to_posix (os .path .join (parent , os .path .basename (parent )))
1511-
1512- # The model only has the following as FileTextField
1513- license_files = about .license_file .value
1514- notice_files = about .notice_file .value
1515- changelog_files = about .changelog_file .value
1516-
1517- if license_files :
1518- for lic in license_files :
1519- lic_path = posixpath .join (dirname (util .to_posix (about_file_path )), lic )
1520- if not posixpath .exists (lic_path ):
1521- msg = (u'Field license_file: Path '
1522- u'%(lic_path)s '
1523- u'not found' % locals ())
1524- errors .append (msg )
1525-
1526- if notice_files :
1527- for notice in notice_files :
1528- notice_path = posixpath .join (dirname (util .to_posix (about_file_path )), notice )
1529- if not posixpath .exists (notice_path ):
1530- msg = (u'Field notice_file: Path '
1531- u'%(notice_path)s '
1532- u'not found' % locals ())
1533- errors .append (msg )
1534-
1535- if changelog_files :
1536- for changelog in changelog_files :
1537- changelog_path = posixpath .join (dirname (util .to_posix (about_file_path )), changelog )
1538- if not posixpath .exists (changelog_path ):
1539- msg = (u'Field changelog_file: Path '
1540- u'%(changelog_path)s '
1541- u'not found' % locals ())
1542- errors .append (msg )
1543- return errors
0 commit comments