diff --git a/setup.py b/setup.py index 10f3ca5..5541c98 100755 --- a/setup.py +++ b/setup.py @@ -225,5 +225,9 @@ setup( }, # While not using a pyproject.toml, support setuptools_scm setup.cfg usage, # see https://github.com/pypa/setuptools_scm/#setupcfg-usage - use_scm_version=True, + use_scm_version={ + 'write_to': 'src/pEp/__version__.py', + #TODO: fallback_version does not seem to work in case os missing tag + 'fallback_version' : '0.0.0-RC0' + } ) diff --git a/src/pEp/__init__.py b/src/pEp/__init__.py index 24c1c06..88d5204 100755 --- a/src/pEp/__init__.py +++ b/src/pEp/__init__.py @@ -8,17 +8,27 @@ # Example: # def underscore_function(): # _pEp._underscore_function() -# + # __all__ could be used to limit the symbols exported when using from import * -# TODO: Commented out until problems solved -# from pkg_resources import DistributionNotFound, get_distribution +try: + from .__version__ import version as __version__ +except ImportError: + import warnings + warnings.warn("Error loading build-time defined __version__.py, trying setuptools now...") + try: + import setuptools_scm + __version__ = setuptools_scm.get_version() + del setuptools_scm + except Exception: + warnings.warn('could not determine %s package version' % __name__) + __version__ = '0.0.dev0+unknown' # Imports all symbols EXCEPT the ones beginning with underscore from ._pEp import * # import the native module into the current namespace because we also need to access the names beginning # with an underscore (of _pEp), but we dont want to import them into this module -import ._pEp +import pEp._pEp # TODO: Commented out until problems solved # try: