Skip to content

Commit

Permalink
Delete old formatting kludges (#2575)
Browse files Browse the repository at this point in the history
  • Loading branch information
pushfoo authored Feb 18, 2025
1 parent 33c4e2d commit 5743504
Showing 1 changed file with 3 additions and 38 deletions.
41 changes: 3 additions & 38 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,42 +70,7 @@
# from arcade.version import VERSION
# or read the docs build will fail.
from version import VERSION # pyright: ignore [reportMissingImports]
log.info(f" Got raw version {VERSION=!r}")


def nice_version(version_string: str) -> str:
"""Format raw VERSION by removing leading zeroes.
When importing VERSION, Python defaults to formatting it as
3.00 as of February 2025.
"""
out = []
for part in version_string.split('.'):
try:
out.append(str(int(part)))
except ValueError as _:
out.append(part)
return '.'.join(out)


# pending: 3.0.1 or 3.1 release?
# Maintain title bar continuity for live doc showing 3.0 as the version
VERSION_SPECIAL_CASES = {'3.0.0': '3.0'}


def _specialcase_version(nice: str) -> str:
if nice in VERSION_SPECIAL_CASES:
new = VERSION_SPECIAL_CASES[nice]
log.info(f" Special-casing version {nice!r} to {new!r}")
else:
new = nice
return new


NICE_VERSION = _specialcase_version(nice_version(VERSION))
# pending: end

log.info(f" Got nice version {NICE_VERSION=!r}")
log.info(f" Got version {VERSION=!r}")


print()
Expand Down Expand Up @@ -261,9 +226,9 @@ def run_util(filename, run_name="__main__", init_globals=None):
# built documents.
#
# The short X.Y version.
version = NICE_VERSION
version = VERSION
# The full version, including alpha/beta/rc tags.
release = NICE_VERSION
release = VERSION

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down

0 comments on commit 5743504

Please sign in to comment.