~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/version.py

  • Committer: John Arbash Meinel
  • Author(s): Mark Hammond
  • Date: 2008-09-09 17:02:21 UTC
  • mto: This revision was merged to the branch mainline in revision 3697.
  • Revision ID: john@arbash-meinel.com-20080909170221-svim3jw2mrz0amp3
An updated transparent icon for bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2004, 2005, 2006, 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
"""Report on version of bzrlib"""
18
18
 
19
 
from __future__ import absolute_import
20
 
 
21
19
import os
22
 
import platform
23
20
import sys
24
21
 
25
22
import bzrlib
26
23
from bzrlib import (
 
24
    bzrdir,
27
25
    config,
28
 
    controldir,
29
26
    errors,
30
27
    osutils,
31
28
    trace,
32
29
    )
 
30
from bzrlib.branch import Branch
33
31
 
34
32
 
35
33
def show_version(show_config=True, show_copyright=True, to_file=None):
50
48
    # show path to python interpreter
51
49
    # (bzr.exe use python interpreter from pythonXY.dll
52
50
    # but sys.executable point to bzr.exe itself)
53
 
    # however, sys.frozen exists if running from bzr.exe
54
 
    # see http://www.py2exe.org/index.cgi/Py2exeEnvironment
55
 
    if getattr(sys, 'frozen', None) is None: # if not bzr.exe
 
51
    if not hasattr(sys, 'frozen'):  # check for bzr.exe
 
52
        # python executable
56
53
        to_file.write(sys.executable + ' ')
57
54
    else:
58
55
        # pythonXY.dll
65
62
 
66
63
    to_file.write("  Python standard library:" + ' ')
67
64
    to_file.write(os.path.dirname(os.__file__) + '\n')
68
 
    to_file.write("  Platform: %s\n"
69
 
                  % platform.platform(aliased=1).decode('utf-8'))
70
65
    to_file.write("  bzrlib: ")
71
66
    if len(bzrlib.__path__) > 1:
72
67
        # print repr, which is a good enough way of making it clear it's
75
70
    else:
76
71
        to_file.write(bzrlib.__path__[0] + '\n')
77
72
    if show_config:
78
 
        config_dir = osutils.normpath(config.config_dir())  # use native slashes
 
73
        config_dir = os.path.normpath(config.config_dir())  # use native slashes
79
74
        if not isinstance(config_dir, unicode):
80
 
            config_dir = config_dir.decode(osutils.get_user_encoding())
 
75
            config_dir = config_dir.decode(bzrlib.user_encoding)
81
76
        to_file.write("  Bazaar configuration: %s\n" % (config_dir,))
82
77
        to_file.write("  Bazaar log file: ")
83
78
        to_file.write(trace._bzr_log_filename + '\n')
84
79
    if show_copyright:
85
80
        to_file.write('\n')
86
81
        to_file.write(bzrlib.__copyright__ + '\n')
87
 
        to_file.write("http://bazaar.canonical.com/\n")
 
82
        to_file.write("http://bazaar-vcs.org/\n")
88
83
        to_file.write('\n')
89
84
        to_file.write("bzr comes with ABSOLUTELY NO WARRANTY.  bzr is free software, and\n")
90
85
        to_file.write("you may use, modify and redistribute it under the terms of the GNU\n")
91
86
        to_file.write("General Public License version 2 or later.\n")
92
 
        to_file.write("\nBazaar is part of the GNU Project to produce a free operating "
93
 
                "system.\n")
94
87
    to_file.write('\n')
95
88
 
96
89
 
100
93
    If bzr is not being run from its working tree, returns None.
101
94
    """
102
95
    try:
103
 
        control = controldir.ControlDir.open_containing(__file__)[0]
 
96
        control = bzrdir.BzrDir.open_containing(__file__)[0]
104
97
        return control.open_workingtree(recommend_upgrade=False)
105
98
    except (errors.NotBranchError, errors.UnknownFormatError,
106
99
            errors.NoWorkingTree):