diff --git a/bob/extension/test_utils.py b/bob/extension/test_utils.py index ae6bca1ab61750ddcb8d78c7ea0f8c52f397a121..d1932c04469e00632a7ceed345f6e01abbe0dc38 100644 --- a/bob/extension/test_utils.py +++ b/bob/extension/test_utils.py @@ -106,20 +106,23 @@ package-z "python", "matplotlib", "bob.extension", - "gridtk", "other.bob.package", ] # test linkage to official documentation - server = "http://www.idiap.ch/software/bob/docs/bob/%s/master/" - os.environ["BOB_DOCUMENTATION_SERVER"] = server + server = ( + "http://www.idiap.ch/software/bob/docs/bob/%s/master/", + "http://www.idiap.ch/software/bob/docs/bob/%s/master/sphinx", + "http://www.idiap.ch/software/bob/docs/bob/%s/main/", + "http://www.idiap.ch/software/bob/docs/bob/%s/main/sphinx", + ) + os.environ["BOB_DOCUMENTATION_SERVER"] = "|".join(server) result = link_documentation(additional_packages, stringio(f)) expected = [ "https://docs.python.org/%d.%d/" % sys.version_info[:2], "https://matplotlib.org/stable/", "https://setuptools.readthedocs.io/en/latest/", - server % "bob.extension", - server % "gridtk", + server[0] % "bob.extension", ] result = [k[0] for k in result.values()] assert sorted(result) == sorted(expected) diff --git a/bob/extension/utils.py b/bob/extension/utils.py index e98a51656c3b33fa67c9c9a7e61998425c54ec3c..3761c2d3425e03308e9f3cb6a9cdd58464eadfc4 100644 --- a/bob/extension/utils.py +++ b/bob/extension/utils.py @@ -198,7 +198,14 @@ def link_documentation( if "BOB_DOCUMENTATION_SERVER" in os.environ: server = os.environ["BOB_DOCUMENTATION_SERVER"] else: - server = "http://www.idiap.ch/software/bob/docs/bob/%(name)s/%(version)s/|http://www.idiap.ch/software/bob/docs/bob/%(name)s/%(version)s/sphinx|http://www.idiap.ch/software/bob/docs/bob/%(name)s/master/|http://www.idiap.ch/software/bob/docs/bob/%(name)s/master/sphinx" + server = ( + "http://www.idiap.ch/software/bob/docs/bob/%(name)s/%(version)s/" + "|http://www.idiap.ch/software/bob/docs/bob/%(name)s/%(version)s/sphinx" + "|http://www.idiap.ch/software/bob/docs/bob/%(name)s/main/" + "|http://www.idiap.ch/software/bob/docs/bob/%(name)s/main/sphinx" + "|http://www.idiap.ch/software/bob/docs/bob/%(name)s/master/" + "|http://www.idiap.ch/software/bob/docs/bob/%(name)s/master/sphinx" + ) # array support for BOB_DOCUMENTATION_SERVER # transforms "(file:///path/to/dir https://example.com/dir| http://bla )" @@ -226,7 +233,7 @@ def link_documentation( ) except pkg_resources.DistributionNotFound: version = "stable" # package is not a runtime dep, only referenced - url = s % {"name": package_name, "version": version} + url = s.format(name=package_name, version=version) try: # otherwise, urlopen will fail @@ -249,6 +256,7 @@ def link_documentation( # url request failed with a something else than 404 Error print("Requesting URL %s returned error: %s" % (url, exc)) # notice mapping is not updated here, as the URL does not exist + print(f"Nothing found at {url}.") except URLError as exc: print( diff --git a/doc/framework.rst b/doc/framework.rst index 24683bcb56bc0881bca7b6ae2ac8d199ad4ac768..f49c9c2ac74f535044f7d7d724c46920ee47f028 100644 --- a/doc/framework.rst +++ b/doc/framework.rst @@ -5,7 +5,7 @@ ================================== It is often required to extend the functionality of your package as a -framework. :ref:`bob.bio.base <bob.bio.base>` is a good example; it provides an +framework. `bob.bio.base <https://gitlab.idiap.ch/bob/bob.bio.base>`__ is a good example; it provides an API and other packages build upon it. The utilities provided in this page are helpful in creating framework packages and building complex toolchians/pipelines.