/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: Jelmer Vernooij
  • Date: 2018-11-11 04:08:32 UTC
  • mto: (7143.16.20 even-more-cleanups)
  • mto: This revision was merged to the branch mainline in revision 7175.
  • Revision ID: jelmer@jelmer.uk-20181111040832-nsljjynzzwmznf3h
Run autopep8.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
 
54
54
version_info = (3, 0, 0, 'alpha', 1)
55
55
 
 
56
 
56
57
def _format_version_tuple(version_info):
57
58
    """Turn a version number 2, 3 or 5-tuple into a short string.
58
59
 
129
130
 
130
131
def _patch_filesystem_default_encoding(new_enc):
131
132
    """Change the Python process global encoding for filesystem names
132
 
    
 
133
 
133
134
    The effect is to change how open() and other builtin functions handle
134
135
    unicode filenames on posix systems. This should only be done near startup.
135
136
 
142
143
    try:
143
144
        import ctypes
144
145
        old_ptr = ctypes.c_void_p.in_dll(ctypes.pythonapi,
145
 
            "Py_FileSystemDefaultEncoding")
 
146
                                         "Py_FileSystemDefaultEncoding")
146
147
        if is_py3:
147
148
            has_enc = ctypes.c_int.in_dll(ctypes.pythonapi,
148
 
                "Py_HasFileSystemDefaultEncoding")
 
149
                                          "Py_HasFileSystemDefaultEncoding")
149
150
            as_utf8 = ctypes.PYFUNCTYPE(
150
151
                ctypes.POINTER(ctypes.c_char), ctypes.py_object)(
151
152
                    ("PyUnicode_AsUTF8", ctypes.pythonapi))
152
153
    except (ImportError, ValueError):
153
 
        return # No ctypes or not CPython implementation, do nothing
 
154
        return  # No ctypes or not CPython implementation, do nothing
154
155
    if is_py3:
155
156
        new_enc = sys.intern(new_enc)
156
157
        enc_ptr = as_utf8(new_enc)