Skip to content

Commit

Permalink
Modifying init file including version number
Browse files Browse the repository at this point in the history
  • Loading branch information
ghislainv committed Apr 26, 2023
1 parent 4d11831 commit 5fd0f60
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
5 changes: 3 additions & 2 deletions forestatrisk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
# Standard library imports
from __future__ import division, print_function # Python 3 compatibility

# Define double undescore variables (https://peps.python.org/pep-0008/#module-level-dunder-names)
# Define double undescore variables
# https://peps.python.org/pep-0008/#module-level-dunder-names
__author__ = "Ghislain Vieilledent"
__email__ = "[email protected]"
__version__ = "1.1"
Expand Down Expand Up @@ -47,4 +48,4 @@
from .validate import resample_sum
from .validate import validation_npix

# EOF
# EOF
5 changes: 2 additions & 3 deletions forestatrisk/forestatrisk.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from __future__ import print_function # Python 3 compatibility

__version__ = "1.1"
import forestatrisk as far


def main():
Expand All @@ -22,7 +22,6 @@ def main():
``forestatrisk`` Python package can be correctly imported.
"""
print("# forestatrisk version {}.".format(__version__))
return None
print("# forestatrisk version {}.".format(far.__version__))

# End
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""Installation setup.
"""

# ==============================================================================
# author :Ghislain Vieilledent
# email :[email protected], [email protected]
Expand All @@ -20,11 +23,11 @@
# find_version
def find_version():
"""Finding package version."""
with open('forestatrisk/forestatrisk.py', encoding="utf-8") as far_file:
far = far_file.read()
with open('forestatrisk/__init__.py', encoding="utf-8") as init_file:
init_text = init_file.read()
far_version = re.search(
'^__version__\\s*=\\s*"(.*)"',
far, re.M).group(1)
init_text, re.M).group(1)
return far_version


Expand Down

0 comments on commit 5fd0f60

Please sign in to comment.