blob: 3802d92113c413f2e73d6150e533932d39668cd9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#!/usr/bin/env python3
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
"""
Extract the latest release notes content from RELEASE_NOTES.md
"""
import argparse
import os
import sys
import traceback
def latest_content(release_notes_path):
"""
can't change the format of the original content
"""
content = ""
start_extract = False
with open(release_notes_path, encoding="utf-8") as f:
for line in f:
if line.startswith("## "):
if start_extract:
break
start_extract = True
continue
# hit a separated line
if line.startswith("---"):
break
content += line
content += os.linesep
return content
def main():
"""
GO!GO!!GO!!!
"""
parser = argparse.ArgumentParser(description="run the sample and examine outputs")
parser.add_argument("release_notes_path", type=str)
args = parser.parse_args()
ret = 1
try:
print(latest_content(args.release_notes_path))
ret = 0
except AssertionError:
traceback.print_exc()
return ret
if __name__ == "__main__":
sys.exit(main())
|