Browse Source

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

PYADPT-100
heck 2 years ago
parent
commit
0af1ba949e
2 changed files with 19 additions and 5 deletions
  1. +5
    -1
      setup.py
  2. +14
    -4
      src/pEp/__init__.py

+ 5
- 1
setup.py View File

@ -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'
}
)

+ 14
- 4
src/pEp/__init__.py View File

@ -8,17 +8,27 @@
# Example:
# def underscore_function():
# _pEp._underscore_function()
#
# __all__ could be used to limit the symbols exported when using from <pkg> 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:


Loading…
Cancel
Save