/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/__init__.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-06-12 01:45:56 UTC
  • mfrom: (7513.1.2 pypy3)
  • Revision ID: breezy.the.bot@gmail.com-20200612014556-tsc8assk3d0luziu
Avoid deprecated behaviour in ElementTree.

Merged from https://code.launchpad.net/~jelmer/brz/pypy3/+merge/385611

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
We hope you enjoy this library.
30
30
"""
31
31
 
32
 
from __future__ import absolute_import
33
 
 
34
32
import time
35
33
 
36
34
# Keep track of when breezy was first imported, so that we can give rough
43
41
 
44
42
__copyright__ = (
45
43
    "Copyright 2005-2012 Canonical Ltd.\n"
46
 
    "Copyright 2017-2019 Breezy developers"
 
44
    "Copyright 2017-2020 Breezy developers"
47
45
)
48
46
 
49
47
# same format as sys.version_info: "A tuple containing the five components of
53
51
# Python version 2.0 is (2, 0, 0, 'final', 0)."  Additionally we use a
54
52
# releaselevel of 'dev' for unreleased under-development code.
55
53
 
56
 
version_info = (3, 1, 0, 'dev', 0)
 
54
version_info = (3, 2, 0, 'dev', 0)
57
55
 
58
56
 
59
57
def _format_version_tuple(version_info):
129
127
    The use of intern() may defer breakage is but is not enough, the string
130
128
    object should be secure against module reloading and during teardown.
131
129
    """
132
 
    is_py3 = sys.version_info > (3,)
133
130
    try:
134
131
        import ctypes
135
132
        old_ptr = ctypes.c_void_p.in_dll(ctypes.pythonapi,
136
133
                                         "Py_FileSystemDefaultEncoding")
137
 
        if is_py3:
138
 
            has_enc = ctypes.c_int.in_dll(ctypes.pythonapi,
139
 
                                          "Py_HasFileSystemDefaultEncoding")
140
 
            as_utf8 = ctypes.PYFUNCTYPE(
141
 
                ctypes.POINTER(ctypes.c_char), ctypes.py_object)(
142
 
                    ("PyUnicode_AsUTF8", ctypes.pythonapi))
 
134
        has_enc = ctypes.c_int.in_dll(ctypes.pythonapi,
 
135
                                      "Py_HasFileSystemDefaultEncoding")
 
136
        as_utf8 = ctypes.PYFUNCTYPE(
 
137
            ctypes.POINTER(ctypes.c_char), ctypes.py_object)(
 
138
                ("PyUnicode_AsUTF8", ctypes.pythonapi))
143
139
    except (ImportError, ValueError):
144
140
        return  # No ctypes or not CPython implementation, do nothing
145
 
    if is_py3:
146
 
        new_enc = sys.intern(new_enc)
147
 
        enc_ptr = as_utf8(new_enc)
148
 
        has_enc.value = 1
149
 
    else:
150
 
        new_enc = intern(new_enc)
151
 
        enc_ptr = ctypes.c_char_p(new_enc)
 
141
    new_enc = sys.intern(new_enc)
 
142
    enc_ptr = as_utf8(new_enc)
 
143
    has_enc.value = 1
152
144
    old_ptr.value = ctypes.cast(enc_ptr, ctypes.c_void_p).value
153
145
    if sys.getfilesystemencoding() != new_enc:
154
146
        raise RuntimeError("Failed to change the filesystem default encoding")