Skip to content

Commit be4af62

Browse files
committed
initial version using setuptools and custom git_describe_command
see the comment in the pyproject.yaml
1 parent 5485f6d commit be4af62

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

pyproject.toml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[build-system]
2+
requires = ["setuptools>=64", "setuptools_scm>=8"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "ssg"
7+
dynamic = ["version"]
8+
dependencies = [
9+
"pyyaml",
10+
"Jinja2",
11+
"setuptools"
12+
]
13+
requires-python = ">= 3"
14+
maintainers = [
15+
{name = "Gabriel Gaspar Becker", email = "ggasparb@redhat.com"},
16+
{name = "Jan Cerny", email = "jcerny@redhat.com"},
17+
{name = "Marcus Burghardt", email = "maburgha@redhat.com"},
18+
{name = "Matthew Burket", email = "mburket@redhat.com"},
19+
{name = "Matus Marhefka", email = "mmarhefk@redhat.com"},
20+
{name = "Vojtech Polasek", email = "vpolasek@redhat.com"}
21+
]
22+
readme = "README.md"
23+
license = {file = "LICENSE"}
24+
25+
[project.urls]
26+
Homepage = "https://github.com/ComplianceAsCode/content"
27+
Documentation = "https://complianceascode.readthedocs.io/en/latest/"
28+
29+
30+
[tool.setuptools_scm]
31+
# The ComplianceasCode/content uses git tag in an uncommon way.
32+
# That's why this elaborate command is used to get somehow meaningful version.
33+
# The project uses tags, but they describe commits which are not in the master branch.
34+
# Instead, they describe commits which are marked as final in stabilization branches.
35+
# These branches are temporary and they are deleted after stabilization finishes.
36+
# That is the reason why the regular "git describe --long" command cannot be used in this place.
37+
# Instead the latest tag is selected with some heuristics added, stored in the $tag variable.
38+
# Then number of commits between the tag and the current head is calculated and stored in the $numcommits variable.
39+
# Then the HEAD short commit hash is added.
40+
git_describe_command = ["sh", "-c", "tag=$(git tag | grep -v '-' | sort | tail -n 1); numcommits=$(git rev-list --count $tag..HEAD); com=$(git log -1 --pretty=format:%h); echo $tag-$numcommits-$com"]
41+
42+
[tool.setuptools.packages.find]
43+
include = ["ssg*"]

0 commit comments

Comments
 (0)