Skip to content

Commit af2ba2d

Browse files
committed
Merge branch 'main' into feature/mulit-version-docs
2 parents 0482f35 + bd4e56b commit af2ba2d

File tree

10 files changed

+350
-338
lines changed

10 files changed

+350
-338
lines changed

.github/actions/python-environment/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ inputs:
66
python-version:
77
description: 'Python version to use'
88
required: true
9-
default: "3.8"
9+
default: "3.10"
1010

1111
poetry-version:
1212
description: 'Poetry version to use'

.github/workflows/checks.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
strategy:
4848
fail-fast: false
4949
matrix:
50-
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
50+
python-version: [ "3.9", "3.10", "3.11" ]
5151

5252
steps:
5353
- name: SCM Checkout
@@ -75,7 +75,7 @@ jobs:
7575
strategy:
7676
fail-fast: false
7777
matrix:
78-
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
78+
python-version: [ "3.9", "3.10", "3.11" ]
7979

8080
steps:
8181
- name: SCM Checkout
@@ -96,7 +96,7 @@ jobs:
9696
strategy:
9797
fail-fast: false
9898
matrix:
99-
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
99+
python-version: [ "3.9", "3.10", "3.11" ]
100100

101101
steps:
102102
- name: SCM Checkout
@@ -126,7 +126,7 @@ jobs:
126126
strategy:
127127
fail-fast: false
128128
matrix:
129-
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
129+
python-version: [ "3.9", "3.10", "3.11" ]
130130
exasol-version: [ "7.1.9" ]
131131

132132
steps:

doc/changes/unreleased.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Unreleased
22

3+
## 🚨 Breaking Changes
4+
5+
* Dropped python 3.8 support
6+
37
## 🐞 Fixed
48

59
* Fixed CD workflow template

doc/conf.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@
6262

6363
# -- Options for HTML output -------------------------------------------------
6464

65-
## Multi version output configuration
66-
smv_tag_whitelist = r'^.*$' # Include all tags
67-
smv_branch_whitelist = r'(master|main)' # Include all branches
68-
smv_remote_whitelist = None # Only use local branches
69-
7065
# The theme to use for HTML and HTML Help pages. See the documentation for
7166
# a list of builtin themes.
7267
#

exasol/toolbox/sphinx/multiversion/__init__.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,19 @@
99
We also took some patches from `this <https://github.com/samuel-emrys/sphinx-multiversion>`_ which was also published under the BSD license.
1010
1111
So huge thanks to the original author `Jan Holthuis <https://github.com/Holzhaus>`_ and all contributors.
12-
13-
TODO's:
14-
* add standard default templates
15-
* add support for index page
16-
* add sorting support
17-
* add gh pages support
18-
* add command to deploy to gh-pages
19-
* add support for loading packed version template?
2012
"""
2113

14+
# TODO:
15+
# * add sorting support
16+
# * add gh pages support
17+
# * add command to deploy to gh-pages
18+
# * add support for loading packed version template?
19+
20+
from exasol.toolbox.version import VERSION
2221
from exasol.toolbox.sphinx.multiversion.main import main
2322
from exasol.toolbox.sphinx.multiversion.sphinx import setup
2423

25-
__version__ = "0.1.0"
24+
__version__ = VERSION
2625

2726
__all__ = [
2827
"setup",

exasol/toolbox/sphinx/multiversion/sphinx.py

Lines changed: 63 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
logger = logging.getLogger(__name__)
1313

1414
DATE_FMT = "%Y-%m-%d %H:%M:%S %z"
15-
DEFAULT_TAG_WHITELIST = r"^.*$"
16-
DEFAULT_BRANCH_WHITELIST = r"^.*$"
15+
DEFAULT_TAG_WHITELIST = r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$"
16+
DEFAULT_BRANCH_WHITELIST = r"(master|main)"
1717
DEFAULT_REMOTE_WHITELIST = None
1818
DEFAULT_RELEASED_PATTERN = r"^tags/.*$"
1919
DEFAULT_OUTPUTDIR_FORMAT = r"{ref.name}"
@@ -40,6 +40,46 @@
4040
)
4141

4242

43+
class TagFormatError(Exception):
44+
"""
45+
Exception raised for errors in the tag format.
46+
47+
The exception is raised when a tag is found to be incorrectly formatted.
48+
"""
49+
50+
51+
class ExasolVersionTag:
52+
53+
def __init__(self, version):
54+
try:
55+
v = version.name.strip()
56+
parts = v.split(".")
57+
major, minor, patch = map(int, parts)
58+
except Exception as ex:
59+
msg = f"Invalid tag format: '{version}', details: {ex}"
60+
raise TagFormatError(msg) from ex
61+
62+
self._version = version
63+
self._version_tripple = (major, minor, patch)
64+
65+
@property
66+
def version(self):
67+
return self._version
68+
69+
@property
70+
def version_triple(self):
71+
return self._version_tripple
72+
73+
@staticmethod
74+
def is_valid_tag(tag):
75+
try:
76+
ExasolVersionTag(tag)
77+
except TagFormatError as ex:
78+
logger.warn("%s", ex)
79+
return False
80+
return True
81+
82+
4383
class VersionInfo:
4484
def __init__(self, app, context, metadata, current_version_name):
4585
self.app = app
@@ -94,30 +134,14 @@ def in_development(self):
94134
]
95135

96136
def __iter__(self):
97-
def to_int(v):
98-
if v == '':
99-
return 0
100-
return int(v, base=0)
101-
102-
def version_key(version):
103-
version = version.strip()
104-
parts = version.split(".")
105-
try:
106-
major = int(parts[0])
107-
minor = int(parts[1])
108-
patch = int(parts[2])
109-
except ValueError as ex:
110-
# TODO: skip tag and log that it was skipped
111-
print(f'version:{version} <<')
112-
print(f'parts:{parts} <<')
113-
print(ex)
114-
return (
115-
major,
116-
minor,
117-
patch
118-
)
137+
tags = (
138+
ExasolVersionTag(tag)
139+
for tag in self.tags if ExasolVersionTag.is_valid_tag(tag)
140+
)
119141
yield from self.branches
120-
yield from sorted(self.tags, key=lambda v: version_key(v.name), reverse=True)
142+
yield from [
143+
t.version for t in sorted(tags, key=lambda t: t.version_triple, reverse=True)
144+
]
121145

122146
def __getitem__(self, name):
123147
v = self.metadata.get(name)
@@ -143,19 +167,22 @@ def vpathto(self, other_version_name):
143167
other_outputroot = os.path.abspath(other_version["outputdir"])
144168
outputroot = os.path.commonpath((current_outputroot, other_outputroot))
145169

146-
current_outputroot = os.path.relpath(current_outputroot, start=outputroot)
170+
current_outputroot = os.path.relpath(
171+
current_outputroot, start=outputroot)
147172
other_outputroot = os.path.relpath(other_outputroot, start=outputroot)
148173

149174
# Ensure that we use POSIX separators in the path (for the HTML code)
150175
if os.sep != posixpath.sep:
151-
current_outputroot = posixpath.join(*os.path.split(current_outputroot))
176+
current_outputroot = posixpath.join(
177+
*os.path.split(current_outputroot))
152178
other_outputroot = posixpath.join(*os.path.split(other_outputroot))
153179

154180
# Find relative path to root of other_version's outputdir
155181
current_outputdir = posixpath.dirname(
156182
posixpath.join(current_outputroot, self.context["pagename"])
157183
)
158-
other_outputdir = posixpath.relpath(other_outputroot, start=current_outputdir)
184+
other_outputdir = posixpath.relpath(
185+
other_outputroot, start=current_outputdir)
159186

160187
if not self.vhasdoc(other_version_name):
161188
return posixpath.join(other_outputdir, "index.html")
@@ -257,10 +284,14 @@ def setup(app):
257284
app.add_config_value("smv_current_version", "", "html")
258285
app.add_config_value("smv_latest_version", "master", "html")
259286
app.add_config_value("smv_tag_whitelist", DEFAULT_TAG_WHITELIST, "html")
260-
app.add_config_value("smv_branch_whitelist", DEFAULT_BRANCH_WHITELIST, "html")
261-
app.add_config_value("smv_remote_whitelist", DEFAULT_REMOTE_WHITELIST, "html")
262-
app.add_config_value("smv_released_pattern", DEFAULT_RELEASED_PATTERN, "html")
263-
app.add_config_value("smv_outputdir_format", DEFAULT_OUTPUTDIR_FORMAT, "html")
287+
app.add_config_value("smv_branch_whitelist",
288+
DEFAULT_BRANCH_WHITELIST, "html")
289+
app.add_config_value("smv_remote_whitelist",
290+
DEFAULT_REMOTE_WHITELIST, "html")
291+
app.add_config_value("smv_released_pattern",
292+
DEFAULT_RELEASED_PATTERN, "html")
293+
app.add_config_value("smv_outputdir_format",
294+
DEFAULT_OUTPUTDIR_FORMAT, "html")
264295
app.add_config_value("smv_build_targets", DEFAULT_BUILD_TARGETS, "html")
265296
app.add_config_value(
266297
"smv_clean_intermediate_files",

exasol/toolbox/templates/github/actions/python-environment/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ inputs:
66
python-version:
77
description: 'Python version to use'
88
required: true
9-
default: 3.8
9+
default: 3.10
1010

1111
poetry-version:
1212
description: 'Poetry version to use'

exasol/toolbox/templates/github/workflows/checks.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
strategy:
5454
fail-fast: false
5555
matrix:
56-
python-version: ["3.8", "3.9", "3.10", "3.11"]
56+
python-version: ["3.9", "3.10", "3.11"]
5757

5858
steps:
5959
- name: SCM Checkout
@@ -81,7 +81,7 @@ jobs:
8181
strategy:
8282
fail-fast: false
8383
matrix:
84-
python-version: ["3.8", "3.9", "3.10", "3.11"]
84+
python-version: ["3.9", "3.10", "3.11"]
8585

8686
steps:
8787
- name: SCM Checkout
@@ -102,7 +102,7 @@ jobs:
102102
strategy:
103103
fail-fast: false
104104
matrix:
105-
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
105+
python-version: [ "3.9", "3.10", "3.11" ]
106106

107107
steps:
108108
- name: SCM Checkout
@@ -132,7 +132,7 @@ jobs:
132132
strategy:
133133
fail-fast: false
134134
matrix:
135-
python-version: ["3.8", "3.9", "3.10", "3.11"]
135+
python-version: ["3.9", "3.10", "3.11"]
136136
exasol-version: ["7.1.9"]
137137

138138
steps:

0 commit comments

Comments
 (0)