nmk-doc 0.3.1__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nmk-doc-0.3.1/src/nmk_doc.egg-info → nmk-doc-0.4.0}/PKG-INFO +1 -1
- {nmk-doc-0.3.1 → nmk-doc-0.4.0}/setup.cfg +1 -1
- {nmk-doc-0.3.1 → nmk-doc-0.4.0}/src/nmk_doc/builders.py +0 -19
- {nmk-doc-0.3.1 → nmk-doc-0.4.0}/src/nmk_doc/doc.yml +2 -10
- nmk-doc-0.4.0/src/nmk_doc/resolvers.py +37 -0
- {nmk-doc-0.3.1 → nmk-doc-0.4.0}/src/nmk_doc/templates/config.py.jinja +0 -1
- {nmk-doc-0.3.1 → nmk-doc-0.4.0/src/nmk_doc.egg-info}/PKG-INFO +1 -1
- nmk-doc-0.3.1/src/nmk_doc/resolvers.py +0 -102
- {nmk-doc-0.3.1 → nmk-doc-0.4.0}/LICENSE +0 -0
- {nmk-doc-0.3.1 → nmk-doc-0.4.0}/README.md +0 -0
- {nmk-doc-0.3.1 → nmk-doc-0.4.0}/setup.py +0 -0
- {nmk-doc-0.3.1 → nmk-doc-0.4.0}/src/nmk_doc/__init__.py +0 -0
- {nmk-doc-0.3.1 → nmk-doc-0.4.0}/src/nmk_doc/badges.yml +0 -0
- {nmk-doc-0.3.1 → nmk-doc-0.4.0}/src/nmk_doc/path.yml +0 -0
- {nmk-doc-0.3.1 → nmk-doc-0.4.0}/src/nmk_doc/plugin-defs.yml +0 -0
- {nmk-doc-0.3.1 → nmk-doc-0.4.0}/src/nmk_doc/plugin.yml +0 -0
- {nmk-doc-0.3.1 → nmk-doc-0.4.0}/src/nmk_doc/templates/__init__.py +0 -0
- {nmk-doc-0.3.1 → nmk-doc-0.4.0}/src/nmk_doc/templates/readthedocs.yaml.jinja +0 -0
- {nmk-doc-0.3.1 → nmk-doc-0.4.0}/src/nmk_doc.egg-info/SOURCES.txt +0 -0
- {nmk-doc-0.3.1 → nmk-doc-0.4.0}/src/nmk_doc.egg-info/dependency_links.txt +0 -0
- {nmk-doc-0.3.1 → nmk-doc-0.4.0}/src/nmk_doc.egg-info/requires.txt +0 -0
- {nmk-doc-0.3.1 → nmk-doc-0.4.0}/src/nmk_doc.egg-info/top_level.txt +0 -0
|
@@ -15,7 +15,7 @@ exclude =
|
|
|
15
15
|
name = nmk-doc
|
|
16
16
|
author = The dynod project
|
|
17
17
|
maintainer = The dynod project
|
|
18
|
-
version = 0.
|
|
18
|
+
version = 0.4.0
|
|
19
19
|
long_description = file: README.md
|
|
20
20
|
long_description_content_type = text/markdown
|
|
21
21
|
license = Mozilla Public License Version 2.0
|
|
@@ -2,27 +2,8 @@
|
|
|
2
2
|
Python module for **nmk-doc** plugin builders.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from pathlib import Path
|
|
6
|
-
|
|
7
5
|
from nmk.model.builder import NmkTaskBuilder
|
|
8
6
|
from nmk.utils import run_with_logs
|
|
9
|
-
from nmk_base.common import TemplateBuilder
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class NmkDocConfigBuilder(TemplateBuilder):
|
|
13
|
-
"""
|
|
14
|
-
Builder used to generate doc config files
|
|
15
|
-
"""
|
|
16
|
-
|
|
17
|
-
def build(self, template: str):
|
|
18
|
-
"""
|
|
19
|
-
Called by the **doc.config** and **doc.rtd** tasks, to generate the **sphinx** + **Read The Docs** config files
|
|
20
|
-
|
|
21
|
-
:param template: Path to the Jinja template to use for generation**
|
|
22
|
-
"""
|
|
23
|
-
|
|
24
|
-
# Just build from template
|
|
25
|
-
self.build_from_template(Path(template), self.main_output, {})
|
|
26
7
|
|
|
27
8
|
|
|
28
9
|
class NmkDocSphinxBuilder(NmkTaskBuilder):
|
|
@@ -28,13 +28,6 @@ config:
|
|
|
28
28
|
# Project author (default: shared author config)
|
|
29
29
|
docAuthor: ${projectAuthor}
|
|
30
30
|
|
|
31
|
-
# Project version (default: use resolver to deduce from git version)
|
|
32
|
-
docVersion:
|
|
33
|
-
__resolver__: nmk_doc.resolvers.NmkDocVersionResolver
|
|
34
|
-
|
|
35
|
-
# Project version increment (used to predict next version, from next git tag)
|
|
36
|
-
docVersionIncrement: "0.1.0"
|
|
37
|
-
|
|
38
31
|
# Project year
|
|
39
32
|
docYear:
|
|
40
33
|
__resolver__: nmk_doc.resolvers.NmkDocYearResolver
|
|
@@ -76,10 +69,9 @@ tasks:
|
|
|
76
69
|
- setup
|
|
77
70
|
if: ${docInputs}
|
|
78
71
|
input:
|
|
79
|
-
- ${gitVersionStamp}
|
|
80
72
|
- ${docConfigTemplate}
|
|
81
73
|
output: ${docConfig}
|
|
82
|
-
builder:
|
|
74
|
+
builder: nmk_base.common.TemplateBuilder
|
|
83
75
|
params:
|
|
84
76
|
template: ${docConfigTemplate}
|
|
85
77
|
|
|
@@ -96,7 +88,7 @@ tasks:
|
|
|
96
88
|
- ${docConfig}
|
|
97
89
|
- ${docRTDConfigTemplate}
|
|
98
90
|
output: ${docRTDConfig}
|
|
99
|
-
builder:
|
|
91
|
+
builder: nmk_base.common.TemplateBuilder
|
|
100
92
|
params:
|
|
101
93
|
template: ${docRTDConfigTemplate}
|
|
102
94
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Module containing all config item resolvers for **nmk-doc** plugin.
|
|
3
|
+
"""
|
|
4
|
+
from datetime import date
|
|
5
|
+
|
|
6
|
+
from nmk.model.resolver import NmkIntConfigResolver
|
|
7
|
+
from nmk_base.resolvers import FilesResolver
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class NmkDocInputsResolver(FilesResolver):
|
|
11
|
+
"""
|
|
12
|
+
Resolves all files in doc folder
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
@property
|
|
16
|
+
def folder_config(self) -> str:
|
|
17
|
+
"""
|
|
18
|
+
Tells **FilesResolver** to search files in **${docPath}** config item.
|
|
19
|
+
"""
|
|
20
|
+
return "docPath"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class NmkDocYearResolver(NmkIntConfigResolver):
|
|
24
|
+
"""
|
|
25
|
+
Current year resolver
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
def get_value(self, name: str) -> int:
|
|
29
|
+
"""
|
|
30
|
+
Get today's year.
|
|
31
|
+
|
|
32
|
+
:param name: config item name to be resolved
|
|
33
|
+
:return: current year
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
# Today's year
|
|
37
|
+
return date.today().year
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
project = "{{ docName }}"
|
|
10
10
|
copyright = "{{ docYear }}, {{ docAuthor }}"
|
|
11
11
|
author = "{{ docAuthor }}"
|
|
12
|
-
release = "{{ docVersion }}"
|
|
13
12
|
|
|
14
13
|
# Extensions configuration
|
|
15
14
|
extensions = [{% for extension in docExtensions %}{% if loop.index > 1 %}, {% endif %}"{{ extension }}"{% endfor %}]
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Module containing all config item resolvers for **nmk-doc** plugin.
|
|
3
|
-
"""
|
|
4
|
-
import re
|
|
5
|
-
from datetime import date
|
|
6
|
-
|
|
7
|
-
from nmk.model.resolver import NmkIntConfigResolver, NmkStrConfigResolver
|
|
8
|
-
from nmk_base.resolvers import FilesResolver
|
|
9
|
-
|
|
10
|
-
DOC_INCREMENT_PATTERN = re.compile("[0-9.]+")
|
|
11
|
-
"""
|
|
12
|
-
Document version increment verification pattern
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class NmkDocInputsResolver(FilesResolver):
|
|
17
|
-
"""
|
|
18
|
-
Resolves all files in doc folder
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
|
-
@property
|
|
22
|
-
def folder_config(self) -> str:
|
|
23
|
-
"""
|
|
24
|
-
Tells **FilesResolver** to search files in **${docPath}** config item.
|
|
25
|
-
"""
|
|
26
|
-
return "docPath"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class NmkDocVersionResolver(NmkStrConfigResolver):
|
|
30
|
-
"""
|
|
31
|
-
Documentation version resolver
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
def get_value(self, name: str) -> str:
|
|
35
|
-
"""
|
|
36
|
-
Get resolved version value.
|
|
37
|
-
Behavior of the version resolution is:
|
|
38
|
-
* take git version (see **${gitVersion}** config item description)
|
|
39
|
-
* if this is a tagged version, simply use it
|
|
40
|
-
* otherwise deduce last tag and increment it with increment configured in **${docVersionIncrement}** config item
|
|
41
|
-
|
|
42
|
-
:param name: config item name to be resolved
|
|
43
|
-
:return: resolved version
|
|
44
|
-
"""
|
|
45
|
-
|
|
46
|
-
# Get git version
|
|
47
|
-
git_version = self.model.config["gitVersion"].value
|
|
48
|
-
|
|
49
|
-
# Check git version segments
|
|
50
|
-
segments = git_version.split("-")
|
|
51
|
-
doc_version = segments[0]
|
|
52
|
-
if len(segments) == 1:
|
|
53
|
-
# This is a tagged version: use it directly
|
|
54
|
-
return doc_version
|
|
55
|
-
|
|
56
|
-
# Not on a tagged version: let's predict the next one with provided increment
|
|
57
|
-
increment = self.model.config["docVersionIncrement"].value
|
|
58
|
-
assert DOC_INCREMENT_PATTERN.match(increment) is not None, f"Invalid docVersionIncrement format: {increment}"
|
|
59
|
-
|
|
60
|
-
# Build predicted version
|
|
61
|
-
doc_version_digits = [int(i) for i in doc_version.split(".")]
|
|
62
|
-
increment_digits = [int(i) for i in increment.split(".")]
|
|
63
|
-
assert len(doc_version_digits) == len(
|
|
64
|
-
increment_digits
|
|
65
|
-
), f"Not the same digits count between version deduced from gitVersion ({doc_version}) and docVersionIncrement ({increment})"
|
|
66
|
-
out_string = ""
|
|
67
|
-
increment_found = False
|
|
68
|
-
for d1, d2 in zip(doc_version_digits, increment_digits):
|
|
69
|
-
# One more digit
|
|
70
|
-
if len(out_string):
|
|
71
|
-
out_string += "."
|
|
72
|
-
|
|
73
|
-
# Increment?
|
|
74
|
-
if d2 > 0:
|
|
75
|
-
# Incremented digit found: do it
|
|
76
|
-
out_string += str(d1 + d2)
|
|
77
|
-
increment_found = True
|
|
78
|
-
elif not increment_found:
|
|
79
|
-
# Incremented digit not found yet: just keep original digit
|
|
80
|
-
out_string += str(d1)
|
|
81
|
-
else:
|
|
82
|
-
# Post-increment digit: set them all to 0
|
|
83
|
-
out_string += "0"
|
|
84
|
-
|
|
85
|
-
return out_string
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
class NmkDocYearResolver(NmkIntConfigResolver):
|
|
89
|
-
"""
|
|
90
|
-
Current year resolver
|
|
91
|
-
"""
|
|
92
|
-
|
|
93
|
-
def get_value(self, name: str) -> int:
|
|
94
|
-
"""
|
|
95
|
-
Get today's year.
|
|
96
|
-
|
|
97
|
-
:param name: config item name to be resolved
|
|
98
|
-
:return: current year
|
|
99
|
-
"""
|
|
100
|
-
|
|
101
|
-
# Today's year
|
|
102
|
-
return date.today().year
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|