Make `get_version` usable from a specified path (#4376)
* Make `get_version` usable from a specified path * Adapt analytics code to get the version from __version__humitos/git/unicode-branches
parent
1b43ee4a7d
commit
9a5f019a4c
|
@ -9,14 +9,15 @@ from future.moves.configparser import RawConfigParser
|
|||
from readthedocs.worker import app # noqa
|
||||
|
||||
|
||||
def get_version():
|
||||
def get_version(setupcfg_path):
|
||||
"""Return package version from setup.cfg."""
|
||||
setupcfg_path = os.path.abspath(
|
||||
os.path.join(os.path.dirname(__file__), '..', 'setup.cfg'),
|
||||
)
|
||||
config = RawConfigParser()
|
||||
config.read(setupcfg_path)
|
||||
return config.get('metadata', 'version')
|
||||
|
||||
|
||||
__version__ = get_version()
|
||||
__version__ = get_version(
|
||||
os.path.abspath(
|
||||
os.path.join(os.path.dirname(__file__), '..', 'setup.cfg'),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -4,7 +4,7 @@ from __future__ import absolute_import
|
|||
|
||||
from django.conf import settings
|
||||
|
||||
from readthedocs import get_version
|
||||
import readthedocs
|
||||
from readthedocs.worker import app
|
||||
|
||||
from .utils import send_to_analytics
|
||||
|
@ -21,7 +21,7 @@ DEFAULT_PARAMETERS = {
|
|||
|
||||
# Application info
|
||||
'an': 'Read the Docs',
|
||||
'av': get_version(), # App version
|
||||
'av': readthedocs.__version__, # App version
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue