Browse Source

define the pEpPythonAdapter version at compile-time. Fallback to setuptools_scm.

master
heck 5 years ago
parent
commit
0af1ba949e
  1. 6
      setup.py
  2. 18
      src/pEp/__init__.py

6
setup.py

@ -225,5 +225,9 @@ setup(
}, },
# While not using a pyproject.toml, support setuptools_scm setup.cfg usage, # While not using a pyproject.toml, support setuptools_scm setup.cfg usage,
# see https://github.com/pypa/setuptools_scm/#setupcfg-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'
}
) )

18
src/pEp/__init__.py

@ -8,17 +8,27 @@
# Example: # Example:
# def underscore_function(): # def underscore_function():
# _pEp._underscore_function() # _pEp._underscore_function()
#
# __all__ could be used to limit the symbols exported when using from <pkg> import * # __all__ could be used to limit the symbols exported when using from <pkg> import *
# TODO: Commented out until problems solved try:
# from pkg_resources import DistributionNotFound, get_distribution 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 # Imports all symbols EXCEPT the ones beginning with underscore
from ._pEp import * from ._pEp import *
# import the native module into the current namespace because we also need to access the names beginning # 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 # 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 # TODO: Commented out until problems solved
# try: # try:

Loading…
Cancel
Save