Skip to content

Commit

Permalink
Merge pull request #81 from ghislainv/dev
Browse files Browse the repository at this point in the history
Catching version number in docsrc/conf.py for Sphinx
  • Loading branch information
ghislainv committed Apr 26, 2023
2 parents 5fd0f60 + ccb43c5 commit e02d845
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docsrc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# The full version, including alpha/beta/rc tags
version = re.search(
'^__version__\s*=\s*"(.*)"',
open('../forestatrisk/forestatrisk.py').read(),
open('../forestatrisk/__init__.py').read(),
re.M
).group(1)
release = version
Expand Down
4 changes: 1 addition & 3 deletions forestatrisk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
# ==============================================================================

"""forestatrisk: modelling and forecasting deforestation in the tropics.
https://ecology.ghislainv.fr/forestatrisk/
"""
https://ecology.ghislainv.fr/forestatrisk/"""

# Standard library imports
from __future__ import division, print_function # Python 3 compatibility
Expand Down
8 changes: 5 additions & 3 deletions forestatrisk/forestatrisk.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
def main():
"""forestatrisk.forestatrisk: provides entry point main().
Running ``forestatrisk`` in the terminal prints ForestAtRisk
Running ``forestatrisk`` in the terminal prints ``forestatrisk``
description and version. Can be used to check that the
``forestatrisk`` Python package can be correctly imported.
``forestatrisk`` Python package has been correctly imported.
"""
print("# forestatrisk version {}.".format(far.__version__))

print(far.__doc__)
print("version {}.".format(far.__version__))

# End
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# find_version
def find_version():
"""Finding package version."""
with open('forestatrisk/__init__.py', encoding="utf-8") as init_file:
with open("forestatrisk/__init__.py", encoding="utf-8") as init_file:
init_text = init_file.read()
far_version = re.search(
'^__version__\\s*=\\s*"(.*)"',
Expand Down

0 comments on commit e02d845

Please sign in to comment.