waf: Get the version numbers from the version file.

This commit is contained in:
Chris Johns 2020-03-12 16:34:16 +11:00
parent 7b53b604c5
commit 19af6b47d5
4 changed files with 43 additions and 5 deletions

View File

@ -1,7 +1,10 @@
import version as rtems_version
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.coverage",
"sphinx.ext.doctest",
"sphinx.ext.extlinks",
"sphinx.ext.graphviz",
"sphinx.ext.intersphinx",
"sphinx.ext.mathjax",
@ -9,6 +12,8 @@ extensions = [
"rtemsdomain",
]
extlinks = {'release_path': ('https://ftp.rtems.org/pub/rtems/releases', None) }
# Add any paths that contain templates here, relative to this directory.
#templates_path = ['build/_templates']
@ -23,17 +28,21 @@ master_doc = 'index'
# General information about the project.
project = u'RTEMS Documentation Project'
copyright = u'1988, 2019 RTEMS Project and contributors'
copyright = u'1988, 2020 RTEMS Project and contributors'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
#version = '@VERSION@'
version = rtems_version.version()
# The full version, including alpha/beta/rc tags.
#release = '@RELEASE@'
release = rtems_version.string()
major = rtems_version.major()
minor = rtems_version.minor()
revision = rtems_version.revision()
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View File

@ -1,6 +1,6 @@
#
# RTEMS Documentation Project (http://www.rtems.org/)
# Copyright 2019 Chris Johns (chrisj@rtems.org)
# Copyright 2019, 2020 Chris Johns (chrisj@rtems.org)
# Copyright (C) 2019 embedded brains GmbH
# All rights reserved.
#
@ -66,6 +66,9 @@ from __future__ import print_function
import os.path
_version = 'invalid'
_major = 0
_minor = 0
_revision = 0
_date = 'unknown date'
_released = False
@ -155,6 +158,17 @@ def get(ctx, rtems_major_version):
_version = version
_date = date
_release = released
if version != 'invalid':
vs = _version.split('.')
_major = vs[0]
if len(vs) == 3:
_minor = vs[1]
_revision = vs[2]
elif len(vs) == 2:
_minor = 0
_revision = vs[1]
else:
ctx.fatal('Invalid version format: %s' % (_version))
return version, date, released
def string():
@ -163,6 +177,15 @@ def string():
def version():
return _version
def major():
return _major
def minor():
return _minor
def revision():
return revision
def date():
return _date

View File

@ -19,7 +19,10 @@ import conf
sphinx_min_version = (1, 3)
def version_cmdline(ctx):
return '-Drelease="%s" -Dversion="%s"' % (ctx.env.RELEASE, ctx.env.VERSION)
return '-Drelease="%s" -Dversion="%s" -Drtems_major="%s" ' \
'-Drtems_minor="%s" -D rtems_revision="%s"' \
% (ctx.env.RELEASE, ctx.env.VERSION, ctx.env.RTEMS_MAJOR,
ctx.env.RTEMS_MINOR, ctx.env.RTEMS_REVISION)
def sphinx_cmdline(ctx, build_type, conf_dir, doctrees,
source_dir, output_dir, configs = []):

View File

@ -86,6 +86,9 @@ def build(ctx):
ctx.env.DATE = ver_date
ctx.env.RELEASE = ver_version + ' (' + ver_date + ')'
ctx.env.VERSION = ver_version
ctx.env.RTEMS_MAJOR = version.major()
ctx.env.RTEMS_MINOR = version.minor()
ctx.env.RTEMS_REVISION = version.revision()
ctx.to_log('Build: %s%s' % (ctx.env.RELEASE, os.linesep))
#