diff options
author | Wayne Davison <wayne@opencoder.net> | 2022-05-06 17:24:07 -0700 |
---|---|---|
committer | Wayne Davison <wayne@opencoder.net> | 2022-05-06 17:42:54 -0700 |
commit | 664639e34959ccdbbb10972ec3b2a24394fbabcb (patch) | |
tree | 1049fe04537688b02ec33aa5e9de7a7c848b65e2 /md-convert | |
parent | 517b9d91fc8eb73680a7b961c6e64ae7a68be23c (diff) | |
download | rsync-664639e34959ccdbbb10972ec3b2a24394fbabcb.tar.gz |
Use the maintainer's timezone for translating the manpage date.
Diffstat (limited to 'md-convert')
-rwxr-xr-x | md-convert | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -115,7 +115,8 @@ NBR_SPACE = ('\xa0', r"\ ") FILENAME_RE = re.compile(r'^(?P<fn>(?P<srcdir>.+/)?(?P<name>(?P<prog>[^/]+?)(\.(?P<sect>\d+))?)\.md)$') ASSIGNMENT_RE = re.compile(r'^(\w+)=(.+)') -QUOTED_RE = re.compile(r'"(.+?)"') +VER_RE = re.compile(r'^#define\s+RSYNC_VERSION\s+"(\d.+?)"', re.M) +TZ_RE = re.compile(r'^#define\s+MAINTAINER_TZ_OFFSET\s+(-?\d+(\.\d+)?)', re.M) VAR_REF_RE = re.compile(r'\$\{(\w+)\}') VERSION_RE = re.compile(r' (\d[.\d]+)[, ]') BIN_CHARS_RE = re.compile(r'[\1-\7]+') @@ -224,8 +225,10 @@ def find_man_substitutions(): with open(srcdir + 'version.h', 'r', encoding='utf-8') as fh: txt = fh.read() - m = QUOTED_RE.search(txt) + m = VER_RE.search(txt) env_subs['VERSION'] = m.group(1) + m = TZ_RE.search(txt) # the tzdata lib may not be installed, so we use a simple hour offset + tz_offset = float(m.group(1)) * 60 * 60 with open('Makefile', 'r', encoding='utf-8') as fh: for line in fh: @@ -241,7 +244,7 @@ def find_man_substitutions(): if var == 'srcdir': break - env_subs['date'] = time.strftime('%d %b %Y', time.localtime(mtime)) + env_subs['date'] = time.strftime('%d %b %Y', time.gmtime(mtime + tz_offset)).lstrip('0') def html_via_commonmark(txt): |