forked from DataDog/apigentools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
35 lines (26 loc) · 1.07 KB
/
setup.py
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
# Unless explicitly stated otherwise all files in this repository are licensed
# under the 3-clause BSD style license (see LICENSE).
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019 Datadog, Inc.
import os
from setuptools import setup
version_template = """\
# Unless explicitly stated otherwise all files in this repository are licensed
# under the 3-clause BSD style license (see LICENSE).
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019 Datadog, Inc.
__version__ = "{version}"
"""
# Allows the fetching of tags even from shallow clones
# https://github.com/pypa/setuptools_scm/pull/118#issuecomment-255381535
def parse_fetch_on_shallow(root):
from setuptools_scm.git import parse, fetch_on_shallow
return parse(root, pre_parse=fetch_on_shallow)
setup(
use_scm_version={
"local_scheme": "dirty-tag",
"write_to": os.path.join("apigentools", "version.py"),
"write_to_template": version_template,
"parse": parse_fetch_on_shallow,
}
)