mirror of
https://git.rtems.org/rtems-docs/
synced 2025-10-17 17:20:31 +08:00
Support VERSION file for releasing and deployment
- Shorten the GIT hash.
This commit is contained in:
55
wscript
55
wscript
@@ -2,13 +2,23 @@
|
||||
# RTEMS Project Documentation
|
||||
#
|
||||
|
||||
from sys import path
|
||||
from os.path import abspath
|
||||
path.append(abspath('common'))
|
||||
import sys
|
||||
import os.path
|
||||
|
||||
sys.path.append(os.path.abspath('common'))
|
||||
|
||||
import waflib
|
||||
import waf as docs_waf
|
||||
import version
|
||||
|
||||
#
|
||||
# Branch version
|
||||
#
|
||||
rtems_major_version = '5'
|
||||
|
||||
#
|
||||
# The documents to build.
|
||||
#
|
||||
build_all = ['user',
|
||||
'c-user',
|
||||
'bsp-howto',
|
||||
@@ -49,43 +59,18 @@ def coverpage_js(ctx):
|
||||
with open(ctx.outputs[0].abspath(), 'w') as o:
|
||||
o.write(js.replace('@CATALOGUE', xml))
|
||||
|
||||
def pretty_day(day):
|
||||
if day == 3:
|
||||
s = 'rd'
|
||||
elif day == 11:
|
||||
s = 'th'
|
||||
elif day == 12:
|
||||
s = 'th'
|
||||
elif day == 13:
|
||||
s = 'th'
|
||||
elif day % 10 == 1:
|
||||
s = 'st'
|
||||
elif day % 10 == 2:
|
||||
s = 'nd'
|
||||
else:
|
||||
s = 'th'
|
||||
return str(day) + s
|
||||
|
||||
def build(ctx):
|
||||
#
|
||||
# Get date and version from Git
|
||||
# Get the version.
|
||||
#
|
||||
version = '5.0.0'
|
||||
if ctx.exec_command(['git', 'diff-index', '--quiet', 'HEAD']) == 0:
|
||||
modified = ''
|
||||
else:
|
||||
modified = '-modified'
|
||||
try:
|
||||
out = ctx.cmd_and_log(['git', 'log', '-1', '--format=%H,%cd', '--date=format:%e,%B,%Y'])
|
||||
f = out.strip('\n').split(',')
|
||||
version = version + '.' + f[0] + modified
|
||||
date = pretty_day(int(f[1])) + ' ' + f[2] + ' ' + f[3]
|
||||
except waflib.Build.Errors.WafError:
|
||||
date = 'unknown date'
|
||||
ctx.env.DATE = date
|
||||
ctx.env.RELEASE = version + ' (' + date + ')'
|
||||
ctx.env.VERSION = version
|
||||
ver_version, ver_date = version.get(ctx, rtems_major_version)
|
||||
ctx.env.DATE = ver_date
|
||||
ctx.env.RELEASE = ver_version + ' (' + ver_date + ')'
|
||||
ctx.env.VERSION = ver_version
|
||||
ctx.to_log('Build: %s%s' % (ctx.env.RELEASE, os.linesep))
|
||||
|
||||
#
|
||||
#
|
||||
# Generate any PlantUML images if enabled.
|
||||
#
|
||||
|
Reference in New Issue
Block a user