| 1 | """ |
|---|
| 2 | Decentralized storage grid. |
|---|
| 3 | |
|---|
| 4 | community web site: U{https://tahoe-lafs.org/} |
|---|
| 5 | """ |
|---|
| 6 | |
|---|
| 7 | __all__ = [ |
|---|
| 8 | "__version__", |
|---|
| 9 | "full_version", |
|---|
| 10 | "branch", |
|---|
| 11 | "__appname__", |
|---|
| 12 | "__full_version__", |
|---|
| 13 | ] |
|---|
| 14 | |
|---|
| 15 | __version__ = "unknown" |
|---|
| 16 | try: |
|---|
| 17 | # type ignored as it fails in CI |
|---|
| 18 | # (https://app.circleci.com/pipelines/github/tahoe-lafs/tahoe-lafs/1647/workflows/60ae95d4-abe8-492c-8a03-1ad3b9e42ed3/jobs/40972) |
|---|
| 19 | from allmydata._version import __version__ # type: ignore |
|---|
| 20 | except ImportError: |
|---|
| 21 | # We're running in a tree that hasn't run update_version, and didn't |
|---|
| 22 | # come with a _version.py, so we don't know what our version is. |
|---|
| 23 | # This should not happen very often. |
|---|
| 24 | pass |
|---|
| 25 | |
|---|
| 26 | full_version = "unknown" |
|---|
| 27 | branch = "unknown" |
|---|
| 28 | try: |
|---|
| 29 | # type ignored as it fails in CI |
|---|
| 30 | # (https://app.circleci.com/pipelines/github/tahoe-lafs/tahoe-lafs/1647/workflows/60ae95d4-abe8-492c-8a03-1ad3b9e42ed3/jobs/40972) |
|---|
| 31 | from allmydata._version import full_version, branch # type: ignore |
|---|
| 32 | except ImportError: |
|---|
| 33 | # We're running in a tree that hasn't run update_version, and didn't |
|---|
| 34 | # come with a _version.py, so we don't know what our full version or |
|---|
| 35 | # branch is. This should not happen very often. |
|---|
| 36 | pass |
|---|
| 37 | |
|---|
| 38 | __appname__ = "tahoe-lafs" |
|---|
| 39 | |
|---|
| 40 | # __full_version__ is the one that you ought to use when identifying yourself |
|---|
| 41 | # in the "application" part of the Tahoe versioning scheme: |
|---|
| 42 | # https://tahoe-lafs.org/trac/tahoe-lafs/wiki/Versioning |
|---|
| 43 | __full_version__ = __appname__ + '/' + str(__version__) |
|---|
| 44 | |
|---|
| 45 | # Monkey-patch 3rd party libraries: |
|---|
| 46 | from ._monkeypatch import patch |
|---|
| 47 | patch() |
|---|
| 48 | del patch |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | # On Python 3, turn BytesWarnings into exceptions. This can have potential |
|---|
| 52 | # production impact... if BytesWarnings are actually present in the codebase. |
|---|
| 53 | # Given that this has been enabled before Python 3 Tahoe-LAFS was publicly |
|---|
| 54 | # released, no such code should exist, and this will ensure it doesn't get |
|---|
| 55 | # added either. |
|---|
| 56 | # |
|---|
| 57 | # Also note that BytesWarnings only happen if Python is run with -b option, so |
|---|
| 58 | # in practice this should only affect tests. |
|---|
| 59 | import warnings |
|---|
| 60 | # Error on BytesWarnings, to catch things like str(b""), but only for |
|---|
| 61 | # allmydata code. |
|---|
| 62 | warnings.filterwarnings("error", category=BytesWarning, module=".*allmydata.*") |
|---|