Oops, `ConfigParser(interpolation=None)` belongs to Python 3.
[update-copyright.git] / update_copyright / project.py
index 7680174655d25279e07cd45d41d4a0f22417d2df..18280b14b3508f251d8ebba48cb7861fa704ccf5 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2012 W. Trevor King <wking@drexel.edu>
+# Copyright (C) 2012 W. Trevor King
 #
 # This file is part of update-copyright.
 #
@@ -103,8 +103,12 @@ class Project (object):
             if vcs == 'Git':
                 self._vcs = _GitBackend()
             elif vcs == 'Bazaar':
+                if _BazaarBackend is None:
+                    raise _bazaar_import_error
                 self._vcs = _BazaarBackend()
             elif vcs == 'Mercurial':
+                if _MercurialBackend is None:
+                    raise _mercurial_import_error
                 self._vcs = _MercurialBackend()
             else:
                 raise NotImplementedError('vcs: {}'.format(vcs))
@@ -125,9 +129,11 @@ class Project (object):
         except _configparser.NoOptionError:
             pass
         try:
-            self._ignored_paths = p.get('files', 'ignored')
+            ignored = p.get('files', 'ignored')
         except _configparser.NoOptionError:
             pass
+        else:
+            self._ignored_paths = [pth.strip() for pth in ignored.split(',')]
         try:
             self._pyfile = p.get('files', 'pyfile')
         except _configparser.NoOptionError:
@@ -229,7 +235,10 @@ class Project (object):
         if self._ignored_paths is not None:
             for path in self._ignored_paths:
                 if _fnmatch.fnmatch(filename, path):
+                    _LOG.debug('ignoring {} (matched {})'.format(
+                            filename, path))
                     return True
         if self._vcs and not self._vcs.is_versioned(filename):
+            _LOG.debug('ignoring {} (not versioned))'.format(filename))
             return True
         return False