~bzr-pqm/bzr/bzr.dev

4070.11.16 by Martin Pool
Fix copyrights and remove assert statement from doc_generate
1
# Copyright (C) 2005 Canonical Ltd
1551.3.11 by Aaron Bentley
Merge from Robert
2
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
7
#
1551.3.11 by Aaron Bentley
Merge from Robert
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
12
#
1551.3.11 by Aaron Bentley
Merge from Robert
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
4183.7.1 by Sabin Iacob
update FSF mailing address
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1551.3.11 by Aaron Bentley
Merge from Robert
16
6379.6.7 by Jelmer Vernooij
Move importing from future until after doc string, otherwise the doc string will disappear.
17
"bash_completion.py - create bash completion script from built-in bzr help"
18
6379.6.3 by Jelmer Vernooij
Use absolute_import.
19
from __future__ import absolute_import
20
1551.3.11 by Aaron Bentley
Merge from Robert
21
import time
22
23
import bzrlib
24
import bzrlib.help
25
import bzrlib.commands
6621.1.1 by Florent Gallaire
Fix for Windows and 32-bit platforms buggy gmtime().
26
import bzrlib.osutils
1551.3.11 by Aaron Bentley
Merge from Robert
27
28
29
def get_filename(options):
30
    return "%s.bash_completion" % (options.bzr_name)
31
32
33
def infogen(options, outfile):
6621.1.1 by Florent Gallaire
Fix for Windows and 32-bit platforms buggy gmtime().
34
    tt = bzrlib.osutils.gmtime()
1551.3.11 by Aaron Bentley
Merge from Robert
35
    params = \
36
           { "bzrcmd": options.bzr_name,
37
             "datestamp": time.strftime("%Y-%m-%d",tt),
38
             "timestamp": time.strftime("%Y-%m-%d %H:%M:%S +0000",tt),
39
             "version": bzrlib.__version__,
40
             }
41
42
    outfile.write(preamble % params)
43
44
45
preamble = """\
1861.2.8 by Alexander Belchenko
More branding: bazaar-ng -> Bazaar; bazaar-ng.org -> bazaar-vcs.org
46
# bash completion functions for for Bazaar (%(bzrcmd)s)
1551.3.11 by Aaron Bentley
Merge from Robert
47
#
48
# Large parts of this file are autogenerated from the internal
1861.2.8 by Alexander Belchenko
More branding: bazaar-ng -> Bazaar; bazaar-ng.org -> bazaar-vcs.org
49
# Bazaar documentation and data structures.
1551.3.11 by Aaron Bentley
Merge from Robert
50
#
51
# Generation time: %(timestamp)s
52
"""
53