From 8c4ce715f44db0a34c36e7b9f0f79c17f9a52cea Mon Sep 17 00:00:00 2001 From: Poruri Sai Rahul Date: Mon, 12 Apr 2021 16:31:24 +0530 Subject: [PATCH 1/2] FIX : Try to import from the package if the file doesnt exist If the package is installed in a non-editable way, the file won't exist in the location we think it exists - so we need to fall back to importing the version information directly from the installed package modified: docs/source/conf.py --- docs/source/conf.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 33fb70ec2..a961c61d8 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -13,8 +13,8 @@ # All configuration values have a default value; values that are commented out # serve to show the default value. -import sys import os +import runpy # The docset build will use slightly different formatting rules @@ -52,11 +52,16 @@ def get_build_docset(): # The default replacements for |version| and |release|, also used in various # other places throughout the built documents. -d = {} -chaco_version_file = os.path.join('..', '..', 'chaco', '_version.py') -exec(compile(open(chaco_version_file).read(), chaco_version_file, 'exec'), d) -release = d['version'] -version = '.'.join(release.split('.',2)[:2]) +base_path = os.path.abspath(os.path.dirname(__file__)) +version_file = os.path.join(base_path, '..', '..', 'chaco', '_version.py') +if os.path.isfile(version_file): + version = release = runpy.run_path(version_file)['full_version'] +else: + try: + from enable._version import full_version as version + release = version + except ImportError: + raise RuntimeError("Enable must be installed before building docs!") # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: From 37edd51db3e5227e033ffe976cae1f2875363759 Mon Sep 17 00:00:00 2001 From: Poruri Sai Rahul Date: Mon, 12 Apr 2021 13:10:01 +0000 Subject: [PATCH 2/2] FIX : Silly me, we care about chaco here, not enable Co-authored-by: aaronayres35 <36972686+aaronayres35@users.noreply.github.com> --- docs/source/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index a961c61d8..7bca165f8 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -58,10 +58,10 @@ def get_build_docset(): version = release = runpy.run_path(version_file)['full_version'] else: try: - from enable._version import full_version as version + from chaco._version import full_version as version release = version except ImportError: - raise RuntimeError("Enable must be installed before building docs!") + raise RuntimeError("Chaco must be installed before building docs!") # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: