Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easier way of obtaining version in docs/conf.py #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 3 additions & 25 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,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 read(filename):
with io.open(relative(filename), encoding='UTF-8') as f:
return f.read()


def get_version():
r = re.compile('''^__version__ = ["'](.+)["']$''')
for line in read('../objgraph.py').splitlines():
m = r.match(line)
if m:
return m.group(1)
raise AssertionError('Could not determine version number from objgraph.py')


def get_short_version():
return '.'.join(get_version().split('.')[:2])

import objgraph

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

Expand Down Expand Up @@ -80,9 +58,9 @@ def get_short_version():
# built documents.
#
# The short X.Y version.
version = get_short_version()
version = objgraph.__version__
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may be misunderstanding Sphinx here, but shouldn't this be truncated to two components? __version__ may also include a bugfix component X.Y.Z.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In documentation I think that should be included full version.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then why is there a separate release setting with the full version?

# The full version, including alpha/beta/rc tags.
release = get_version()
release = objgraph.__version__

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