~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2011-05-11 11:35:28 UTC
  • mto: This revision was merged to the branch mainline in revision 5851.
  • Revision ID: john@arbash-meinel.com-20110511113528-qepibuwxicjrbb2h
Break compatibility with python <2.6.

This includes auditing the code for places where we were doing
explicit 'sys.version' checks and removing them as appropriate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 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
52
52
# Python version 2.0 is (2, 0, 0, 'final', 0)."  Additionally we use a
53
53
# releaselevel of 'dev' for unreleased under-development code.
54
54
 
55
 
version_info = (2, 3, 0, 'dev', 1)
 
55
version_info = (2, 4, 0, 'dev', 3)
56
56
 
57
57
# API compatibility version
58
 
api_minimum_version = (2, 2, 0)
 
58
api_minimum_version = (2, 4, 0)
59
59
 
60
60
 
61
61
def _format_version_tuple(version_info):
71
71
    1.0.0
72
72
    >>> print _format_version_tuple((1, 2, 0, 'dev', 0))
73
73
    1.2.0dev
74
 
    >>> print bzrlib._format_version_tuple((1, 2, 0, 'dev', 1))
 
74
    >>> print _format_version_tuple((1, 2, 0, 'dev', 1))
75
75
    1.2.0dev1
76
76
    >>> print _format_version_tuple((1, 1, 1, 'candidate', 2))
77
77
    1.1.1rc2
78
 
    >>> print bzrlib._format_version_tuple((2, 1, 0, 'beta', 1))
 
78
    >>> print _format_version_tuple((2, 1, 0, 'beta', 1))
79
79
    2.1b1
80
80
    >>> print _format_version_tuple((1, 4, 0))
81
81
    1.4.0
82
82
    >>> print _format_version_tuple((1, 4))
83
83
    1.4
84
 
    >>> print bzrlib._format_version_tuple((2, 1, 0, 'final', 1))
 
84
    >>> print _format_version_tuple((2, 1, 0, 'final', 1))
85
85
    Traceback (most recent call last):
86
86
    ...
87
87
    ValueError: version_info (2, 1, 0, 'final', 1) not valid
157
157
 
158
158
    More options may be added in future so callers should use named arguments.
159
159
 
 
160
    The object returned by this function can be used as a contex manager
 
161
    through the 'with' statement to automatically shut down when the process
 
162
    is finished with bzrlib.  However (from bzr 2.4) it's not necessary to
 
163
    separately enter the context as well as starting bzr: bzrlib is ready to
 
164
    go when this function returns.
 
165
 
160
166
    :param setup_ui: If true (default) use a terminal UI; otherwise 
161
167
        some other ui_factory must be assigned to `bzrlib.ui.ui_factory` by
162
168
        the caller.
163
169
    :param stdin, stdout, stderr: If provided, use these for terminal IO;
164
170
        otherwise use the files in `sys`.
165
 
    :return: A context manager for the use of bzrlib. The __enter__ method of
166
 
        this context needs to be called before it takes effect, and the __exit__
 
171
    :return: A context manager for the use of bzrlib. The __exit__
167
172
        should be called by the caller before exiting their process or
168
173
        otherwise stopping use of bzrlib. Advanced callers can use
169
174
        BzrLibraryState directly.
178
183
    else:
179
184
        ui_factory = None
180
185
    tracer = trace.DefaultConfig()
181
 
    return library_state.BzrLibraryState(ui=ui_factory, trace=tracer)
 
186
    state = library_state.BzrLibraryState(ui=ui_factory, trace=tracer)
 
187
    # Start automatically in case people don't realize this returns a context.
 
188
    state._start()
 
189
    return state
182
190
 
183
191
 
184
192
def test_suite():