File: __init__.py

package info (click to toggle)
flit-scm 1.7.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 84 kB
  • sloc: python: 19; makefile: 3
file content (25 lines) | stat: -rw-r--r-- 736 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from flit_core import buildapi # Make Flit's build backend available as "flit_scm:buildapi"
from setuptools_scm import get_version

try:
    import tomllib
except ImportError:
    import tomli as tomllib


try:
    with open('pyproject.toml', 'rb') as f:
        pyproject = tomllib.load(f)
except OSError:
    pass # Do nothing if unable to access `pyproject.toml`
else:
    try:
        setuptools_scm_config = pyproject['tool']['setuptools_scm']
    except KeyError:
        pass # Do nothing if `setuptools_scm` is not configured in `pyproject.toml`
    else:
        get_version(**setuptools_scm_config)


# Import the version after writing the version file, to allow for bootstrapping
from ._version import version as __version__