[Docs] Fix build errors getting Deluge version
The use of pkg_resource.require caused an unwanted requirements lookup that errored out the sphinx build when no dependencies are installed. This is fixed by switching to pkg_resources.get_distribution. Also changed the tox docs env to not install Deluge as the setup.py now contains install_requires which is unwanted.
This commit is contained in:
parent
82ecf8a416
commit
20431cc771
|
@ -87,14 +87,12 @@ PY2 = sys.version_info.major == 2
|
||||||
|
|
||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
"""
|
"""The program version from the egg metadata.
|
||||||
Returns the program version from the egg metadata
|
|
||||||
|
|
||||||
:returns: the version of Deluge
|
|
||||||
:rtype: string
|
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
str: The version of Deluge.
|
||||||
"""
|
"""
|
||||||
return pkg_resources.require('Deluge')[0].version
|
return pkg_resources.get_distribution('Deluge').version
|
||||||
|
|
||||||
|
|
||||||
def get_default_config_dir(filename=None):
|
def get_default_config_dir(filename=None):
|
||||||
|
@ -289,14 +287,17 @@ def get_pixmap(fname):
|
||||||
|
|
||||||
|
|
||||||
def resource_filename(module, path):
|
def resource_filename(module, path):
|
||||||
"""While developing, if there's a second deluge package, installed globally
|
"""Get filesystem path for a resource.
|
||||||
and another in develop mode somewhere else, while pkg_resources.require('Deluge')
|
|
||||||
returns the proper deluge instance, pkg_resources.resource_filename does
|
This function contains a work-around for pkg_resources.resource_filename
|
||||||
not, it returns the first found on the python path, which is not good
|
not returning the correct path with multiple packages installed.
|
||||||
enough.
|
|
||||||
This is a work-around that.
|
So if there's a second deluge package, installed globally and another in
|
||||||
|
develop mode somewhere else, while pkg_resources.get_distribution('Deluge')
|
||||||
|
returns the proper deluge instance, pkg_resources.resource_filename
|
||||||
|
does not, it returns the first found on the python path, which is wrong.
|
||||||
"""
|
"""
|
||||||
return pkg_resources.require('Deluge>=%s' % get_version())[0].get_resource_filename(
|
return pkg_resources.get_distribution('Deluge').get_resource_filename(
|
||||||
pkg_resources._manager, os.path.join(*(module.split('.') + [path]))
|
pkg_resources._manager, os.path.join(*(module.split('.') + [path]))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ copyright = '2008-%s, Deluge Team' % current_year # noqa: A001
|
||||||
if get_version:
|
if get_version:
|
||||||
version = get_version(prefix='deluge-', suffix='.dev0')
|
version = get_version(prefix='deluge-', suffix='.dev0')
|
||||||
else:
|
else:
|
||||||
version = pkg_resources.require('Deluge')[0].version
|
version = pkg_resources.get_distribution('Deluge').version
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = version
|
release = version
|
||||||
|
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -156,6 +156,7 @@ deps =
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
basepython = python2.7
|
basepython = python2.7
|
||||||
sitepackages = {[docsbase]sitepackages}
|
sitepackages = {[docsbase]sitepackages}
|
||||||
|
skip_install = True
|
||||||
deps = {[docsbase]deps}
|
deps = {[docsbase]deps}
|
||||||
commands =
|
commands =
|
||||||
python setup.py clean_docs
|
python setup.py clean_docs
|
||||||
|
@ -165,6 +166,7 @@ commands =
|
||||||
[testenv:docscoverage]
|
[testenv:docscoverage]
|
||||||
basepython = python2.7
|
basepython = python2.7
|
||||||
sitepackages = {[docsbase]sitepackages}
|
sitepackages = {[docsbase]sitepackages}
|
||||||
|
skip_install = True
|
||||||
changedir = {[docsbase]changedir}
|
changedir = {[docsbase]changedir}
|
||||||
deps =
|
deps =
|
||||||
{[docsbase]deps}
|
{[docsbase]deps}
|
||||||
|
|
Loading…
Reference in New Issue