~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/version.py

  • Committer: Andrew Bennetts
  • Date: 2010-10-08 08:15:14 UTC
  • mto: This revision was merged to the branch mainline in revision 5498.
  • Revision ID: andrew.bennetts@canonical.com-20101008081514-dviqzrdfwyzsqbz2
Split NEWS into per-release doc/en/release-notes/bzr-*.txt

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