/loggerhead/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/loggerhead/trunk

« back to all changes in this revision

Viewing changes to loggerhead/__init__.py

  • Committer: Ubuntu One Auto Copilot
  • Author(s): Jelmer Vernooij
  • Date: 2022-08-30 10:28:23 UTC
  • mfrom: (533.1.1 trunk)
  • Revision ID: otto-copilot@canonical.com-20220830102823-u3w6efosxw5s086s
Cope with moved errors NoSuchFile and FileExists in newer versions of Breezy.

Merged from https://code.launchpad.net/~jelmer/loggerhead/moved-errors/+merge/429073

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335  USA
17
17
 
18
 
"""A simple container to turn this into a python package.
19
 
 
20
 
We also check the versions of some dependencies.
21
 
"""
22
 
 
23
 
import pkg_resources
24
 
 
25
 
__version__ = '1.18.2'  # Keep in sync with ../info.py.
 
18
"""A simple container to turn this into a python package."""
 
19
 
 
20
try:
 
21
    import importlib.metadata as importlib_metadata
 
22
except ImportError:
 
23
    import importlib_metadata
 
24
 
 
25
try:
 
26
    __version__ = importlib_metadata.version("loggerhead")
 
27
except importlib_metadata.PackageNotFoundError:
 
28
    # Support running tests from the build tree without installation.
 
29
    import os
 
30
    from setuptools.config import read_configuration
 
31
    cfg = read_configuration(os.path.join(os.path.dirname(__file__), '..', 'setup.cfg'))
 
32
    __version__ = cfg['metadata']['version']
26
33
__revision__ = None
27
 
required_breezy = (1, 17)
28
 
 
29
 
pkg_resources.get_distribution('Paste>=1.6')
30
 
try:
31
 
    pkg_resources.get_distribution('PasteDeploy>=1.3')
32
 
except pkg_resources.DistributionNotFound:
33
 
    # No paste.deploy is OK, but an old paste.deploy is bad.
34
 
    pass
35
 
 
36
 
try:
37
 
    from breezy.branch import Branch
38
 
    branch = Branch.open('./');
39
 
 
40
 
    __revision__ = branch.revno()
41
 
    
42
 
except:
43
 
    pass
 
34
required_breezy = (3, 1)