blob: 0b3e0c71f00fd5d9d018d04c9cf0b1395562d54b (
plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
"""\
important note:
the setup of setuptools_scm is self-using,
the first execution of `python setup.py egg_info`
will generate partial data
its critical to run `python setup.py egg_info`
once before running sdist or easy_install on a fresh checkouts
pip usage is recommended
"""
from __future__ import print_function
import os
import sys
import setuptools
def scm_config():
here = os.path.dirname(os.path.abspath(__file__))
src = os.path.join(here, "src")
egg_info = os.path.join(src, "setuptools_scm.egg-info")
has_entrypoints = os.path.isdir(egg_info)
import pkg_resources
sys.path.insert(0, src)
pkg_resources.working_set.add_entry(src)
# FIXME: remove debug
print(src)
print(pkg_resources.working_set)
from setuptools_scm.hacks import parse_pkginfo
from setuptools_scm.git import parse as parse_git
from setuptools_scm.version import guess_next_dev_version, get_local_node_and_date
def parse(root):
try:
return parse_pkginfo(root)
except IOError:
return parse_git(root)
config = dict(
version_scheme=guess_next_dev_version, local_scheme=get_local_node_and_date
)
if has_entrypoints:
return dict(use_scm_version=config)
else:
from setuptools_scm import get_version
return dict(version=get_version(root=here, parse=parse, **config))
if __name__ == "__main__":
setuptools.setup(**scm_config())
|