mgedmin/objgraph

3.5.0: documentation build fails

kloczek opened this issue · 6 comments

Looks like something is wrong with conf.py

+ /usr/bin/sphinx-build -n -T -b man docs build/sphinx/man
Running Sphinx v6.2.1

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 353, in eval_config_file
    code = compile(f.read(), filename.encode(fs_encoding), 'exec')
  File "/home/tkloczko/rpmbuild/BUILD/objgraph-3.5.0/docs/conf.py", line 27
    exec open(relative('../objgraph.py')).read() in d
         ^
SyntaxError: invalid syntax

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 280, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 207, in __init__
    self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 177, in read
    namespace = eval_config_file(filename, tags)
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 357, in eval_config_file
    raise ConfigError(msg % err) from err
sphinx.errors.ConfigError: There is a syntax error in your configuration file: invalid syntax (conf.py, line 27)

OK here is quick patch:

--- a/docs/conf.py
+++ b/docs/conf.py
@@ -18,17 +18,7 @@
 # documentation root, use os.path.abspath to make it absolute, like shown here.
 sys.path.append(os.path.abspath('..'))

-def relative(filename):
-    here = os.path.dirname('__file__')
-    return os.path.join(here, filename)
-
-def get_version():
-    d = {}
-    exec open(relative('../objgraph.py')).read() in d
-    return d['__version__']
-
-def get_short_version():
-    return '.'.join(get_version().split('.')[:2])
+import objgraph

 # -- General configuration -----------------------------------------------------

@@ -57,9 +47,9 @@
 # built documents.
 #
 # The short X.Y version.
-version = get_short_version()
+version = objgraph.__version__
 # The full version, including alpha/beta/rc tags.
-release = get_version()
+release = version.split('.')[:2]

 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.

Please let me know if you wan this patch as PR.

It's been fixed in git a while ago: e96d904.

I'll make a new release.

Whee and I made a new release and I built new docs and my CSS is badly broken and whyyyyyyy I didn't change anything is it because Sphinx released new upstream versions?

Fixed the docs.

Anyway, in the 3.6.0 release this issue is fixed.

Please have a look one more time on proposed patch which contains way simpler solution.

You're probably right.