$36 GRAYBYTE WORDPRESS FILE MANAGER $64

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/cloudlinux/venv/lib/python3.11/site-packages/raven/

HOME
Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/raven//versioning.py
from __future__ import absolute_import

import os.path

from raven.utils.compat import text_type
from .exceptions import InvalidGitRepository

__all__ = ('fetch_git_sha', 'fetch_package_version')


def fetch_git_sha(path, head=None):
    """
    >>> fetch_git_sha(os.path.dirname(__file__))
    """
    if not head:
        head_path = os.path.join(path, '.git', 'HEAD')
        if not os.path.exists(head_path):
            raise InvalidGitRepository(
                'Cannot identify HEAD for git repository at %s' % (path,))

        with open(head_path, 'r') as fp:
            head = text_type(fp.read()).strip()

        if head.startswith('ref: '):
            head = head[5:]
            revision_file = os.path.join(
                path, '.git', *head.split('/')
            )
        else:
            return head
    else:
        revision_file = os.path.join(path, '.git', 'refs', 'heads', head)

    if not os.path.exists(revision_file):
        if not os.path.exists(os.path.join(path, '.git')):
            raise InvalidGitRepository(
                '%s does not seem to be the root of a git repository' % (path,))

        # Check for our .git/packed-refs' file since a `git gc` may have run
        # https://git-scm.com/book/en/v2/Git-Internals-Maintenance-and-Data-Recovery
        packed_file = os.path.join(path, '.git', 'packed-refs')
        if os.path.exists(packed_file):
            with open(packed_file) as fh:
                for line in fh:
                    line = line.rstrip()
                    if line and line[:1] not in ('#', '^'):
                        try:
                            revision, ref = line.split(' ', 1)
                        except ValueError:
                            continue
                        if ref == head:
                            return text_type(revision)

        raise InvalidGitRepository(
            'Unable to find ref to head "%s" in repository' % (head,))

    with open(revision_file) as fh:
        return text_type(fh.read()).strip()


def fetch_package_version(dist_name):
    """
    >>> fetch_package_version('sentry')
    """
    try:
        # Importing pkg_resources can be slow, so only import it
        # if we need it.
        import pkg_resources
    except ImportError:
        # pkg_resource is not available on Google App Engine
        raise NotImplementedError('pkg_resources is not available '
                                  'on this Python install')
    dist = pkg_resources.get_distribution(dist_name)
    return dist.version

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
17 Dec 2025 3.08 AM
root / root
0755
__pycache__
--
14 Aug 2025 9.24 PM
root / root
0755
conf
--
14 Aug 2025 9.24 PM
root / root
0755
contrib
--
14 Aug 2025 9.24 PM
root / root
0755
data
--
14 Aug 2025 9.24 PM
root / root
0755
handlers
--
14 Aug 2025 9.24 PM
root / root
0755
scripts
--
14 Aug 2025 9.24 PM
root / root
0755
transport
--
14 Aug 2025 9.24 PM
root / root
0755
utils
--
14 Aug 2025 9.24 PM
root / root
0755
__init__.py
1.209 KB
17 Apr 2025 8.10 PM
root / root
0644
base.py
29.401 KB
17 Apr 2025 8.10 PM
root / root
0644
breadcrumbs.py
12.912 KB
17 Apr 2025 8.10 PM
root / root
0644
context.py
3.776 KB
17 Apr 2025 8.10 PM
root / root
0644
events.py
4.563 KB
17 Apr 2025 8.10 PM
root / root
0644
exceptions.py
0.605 KB
17 Apr 2025 8.10 PM
root / root
0644
middleware.py
3.51 KB
17 Apr 2025 8.10 PM
root / root
0644
processors.py
5.262 KB
17 Apr 2025 8.10 PM
root / root
0644
versioning.py
2.484 KB
17 Apr 2025 8.10 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF