~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/version.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-03-25 00:02:51 UTC
  • mfrom: (5106.1.1 version-bump)
  • Revision ID: pqm@pqm.ubuntu.com-20100325000251-bwsv5c5d3l9x3lnn
(Jelmer) Bump API version for 2.2.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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):
 
34
    import platform
 
35
 
36
36
    if to_file is None:
37
37
        to_file = sys.stdout
38
38
    to_file.write("Bazaar (bzr) %s\n" % bzrlib.__version__)
65
65
 
66
66
    to_file.write("  Python standard library:" + ' ')
67
67
    to_file.write(os.path.dirname(os.__file__) + '\n')
68
 
    to_file.write("  Platform: %s\n"
69
 
                  % platform.platform(aliased=1).decode('utf-8'))
 
68
    to_file.write("  Platform: %s\n" % platform.platform(aliased=1))
70
69
    to_file.write("  bzrlib: ")
71
70
    if len(bzrlib.__path__) > 1:
72
71
        # print repr, which is a good enough way of making it clear it's
75
74
    else:
76
75
        to_file.write(bzrlib.__path__[0] + '\n')
77
76
    if show_config:
78
 
        config_dir = osutils.normpath(config.config_dir())  # use native slashes
 
77
        config_dir = os.path.normpath(config.config_dir())  # use native slashes
79
78
        if not isinstance(config_dir, unicode):
80
79
            config_dir = config_dir.decode(osutils.get_user_encoding())
81
80
        to_file.write("  Bazaar configuration: %s\n" % (config_dir,))
100
99
    If bzr is not being run from its working tree, returns None.
101
100
    """
102
101
    try:
103
 
        control = controldir.ControlDir.open_containing(__file__)[0]
 
102
        control = bzrdir.BzrDir.open_containing(__file__)[0]
104
103
        return control.open_workingtree(recommend_upgrade=False)
105
104
    except (errors.NotBranchError, errors.UnknownFormatError,
106
105
            errors.NoWorkingTree):