4 Copyright (c) 2009--210 Jan Nieuwenhuizen <janneke@gnu.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 sys
.path
.insert (0, '@top-src-dir@/scripts/build')
31 def read_pipe (cmd
, ignore_errors
=False):
34 if pipe
.close () and not ignore_errors
:
35 raise SystemFailed ('Pipe failed: %(cmd)s' % locals ())
38 def filter_out (p
, lst
):
39 return filter (lambda x
: not p (x
), lst
)
53 files
= filter_out (lambda x
: (os
.path
.basename (x
) in copied_files
54 or 'CHANGES' in x
or 'ChangeLog' in x
),
55 read_pipe ('cd @top-src-dir@ && git ls-files').split ())
56 os
.chdir ('@top-src-dir@')
57 year
= datetime
.datetime
.now ().year
59 last_year_1d
= last_year
% 10
61 pytt
.pytt ('(Copyright|\(c\)|\(C\)|@copyright\{\})\s*%(last_year)s([^-]|$)' % locals (),
62 r
'\1 %(last_year)s--%(year)s' % locals (),
64 pytt
.pytt ('(Copyright|\(c\)|\(C\)|@copyright\{\})\s*([^-]*)--(20[0-9][0-%(last_year_1d)s])' % locals (),
65 r
'\1 \2--%(year)s' % locals (),
68 if __name__
== '__main__':