[PATCH 10/12] copyright: Accept (and re-write) Format-Specification.

John Wright jsw at debian.org
Sun Aug 31 21:26:16 UTC 2014


From: John Wright <jsw at google.com>

Old versions of the format used Format-Specification instead of Format
to specify the version of the format.  This change just rewrites that
field upon import as Format.

There are other issues with old specs that this change does not attempt
to solve, including:
  - Different format for Files (e.g. comma-separated instead of
    whitespace, ** vs *, beginning patterns with ./).
  - Paragraphs that are not in the current standard (e.g.
    Removed-Files).
I think this module should just worry about making sure these old
formats actually parse.  Other tools can build on top of it to try to
normalize old field values.
---
 lib/debian/copyright.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/debian/copyright.py b/lib/debian/copyright.py
index 70e1542..07a035a 100644
--- a/lib/debian/copyright.py
+++ b/lib/debian/copyright.py
@@ -499,6 +499,13 @@ class Header(deb822.RestrictedWrapper):
         if data is None:
             data = deb822.Deb822()
             data['Format'] = _CURRENT_FORMAT
+
+        if 'Format-Specification' in data:
+            warnings.warn('use of deprecated "Format-Specification" field;'
+                          ' rewriting as "Format"')
+            data['Format'] = data['Format-Specification']
+            del data['Format-Specification']
+
         super(Header, self).__init__(data)
 
         fmt = self.format
-- 
2.1.0




More information about the pkg-python-debian-maint mailing list