mirror of
https://github.com/python-escpos/python-escpos
synced 2025-08-24 09:03:34 +00:00
add version-strings into the module
The version string is in the module as __version__ available. In the doc the version will be automatically parsed. The version comes from the installed module if on read the docs or directly from setuptools_scm if you are working locally. The CLI will issue the version string if you call it with the option 'version'. The CLI does not accept commands like '--version', since this would not be conform with the rest of the interface (and argparse). The configuration for loading the version-string is adapted from pimutils/vdirsyncer. It autogenerates a version string setuptools_scm at install-time and then adds it to the __version__ member in __init__.py I adapted the GitHub-template with a fitting comment and bumped the changelog. closes #141
This commit is contained in:
15
doc/conf.py
15
doc/conf.py
@@ -15,7 +15,10 @@
|
||||
import sys
|
||||
import os
|
||||
on_rtd = os.getenv('READTHEDOCS') == 'True'
|
||||
from setuptools_scm import get_version
|
||||
if on_rtd:
|
||||
import escpos
|
||||
else:
|
||||
from setuptools_scm import get_version
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
@@ -70,10 +73,14 @@ copyright = u'2016, Manuel F Martinez and others'
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
if on_rtd:
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = escpos.__version__
|
||||
else:
|
||||
# locally setuptools_scm should work
|
||||
release = get_version(root=root)
|
||||
# The short X.Y version.
|
||||
version = get_version(root=root)
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = version
|
||||
version = '.'.join(release.split('.')[:2]) # The short X.Y version.
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
Reference in New Issue
Block a user