mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
parent
1b49fd0e42
commit
ded9e7d5b1
5 changed files with 291 additions and 2 deletions
41
scripts/get-tdm-gcc.sh
Normal file
41
scripts/get-tdm-gcc.sh
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!/bin/sh
|
||||
# This script is to set up tdm-gcc environment for windows ci.
|
||||
# BE CAREFUL! THIS SCRIPT WILL DESTROY THE ROOT OF TDM-DCC AT FIRST.
|
||||
# Usage:
|
||||
# bash /path/to/the/script /path/to/tdm-gcc/sysroot <URL>
|
||||
|
||||
BASEDIR=$(rm -rf $1 && mkdir $1 && cd $1 && pwd)
|
||||
TDM_URL=$2
|
||||
|
||||
function DecompressTDM () {
|
||||
echo "Downloading From ${TDM_URL}..."
|
||||
wget ${TDM_URL} -O "${BASEDIR}/tdm.exe" > /dev/null
|
||||
echo "Decompress the archive..."
|
||||
7z e -y "${BASEDIR}/tdm.exe" -o"${BASEDIR}" > /dev/null
|
||||
for tarbar in "${BASEDIR}/"*.tar.xz
|
||||
do
|
||||
# We can't use tar -Jxvf here, it will cause pipeline hanging.
|
||||
xz -d "${tarbar}" -c > "${tarbar%.xz}"
|
||||
tar -xf "${tarbar%.xz}" -C ${BASEDIR}
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
function CreateFeaturesHeader() {
|
||||
echo "Creating features.h..."
|
||||
cat > "${BASEDIR}/include/features.h" <<EOF
|
||||
#ifndef __MINGW_FEATURES__
|
||||
#pragma GCC system_header
|
||||
|
||||
#define __MINGW_FEATURES__ (__MINGW_FEATURES_BEGIN__) \\
|
||||
__MINGW_FEATURE_IGNORE__ (__MINGW_ANSI_STDIO__) \\
|
||||
__MINGW_FEATURE_IGNORE__ (__MINGW_LC_MESSAGES__) \\
|
||||
__MINGW_FEATURE_IGNORE__ (__MINGW_LC_ENVVARS__) \\
|
||||
__MINGW_FEATURES_END__
|
||||
|
||||
#endif
|
||||
EOF
|
||||
}
|
||||
|
||||
DecompressTDM
|
||||
CreateFeaturesHeader
|
32
scripts/parse-changelog.py
Normal file
32
scripts/parse-changelog.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env python3
|
||||
from pathlib import Path
|
||||
from argparse import ArgumentParser
|
||||
|
||||
|
||||
def parse_latest_changelog(text: str) -> str:
|
||||
"""Read the contents between the first `##` and the second `##`"""
|
||||
recording = False
|
||||
contents: list[str] = []
|
||||
for line in text.splitlines():
|
||||
if line.strip().startswith("## ") and recording is False:
|
||||
recording = True
|
||||
elif line.strip().startswith("## ") and recording is True:
|
||||
break
|
||||
if recording:
|
||||
contents.append(line)
|
||||
|
||||
return "\n".join(contents[1:])
|
||||
|
||||
|
||||
def get_changelog() -> str:
|
||||
parser = ArgumentParser(description="Get the latest change log from CHANG_LOGS.md")
|
||||
parser.add_argument("changelog_file", help="The path of CHANGE_LOGS.md")
|
||||
args = parser.parse_args()
|
||||
with Path(args.changelog_file).open() as f:
|
||||
return f.read()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
changelog = get_changelog()
|
||||
latest_changelog = parse_latest_changelog(changelog)
|
||||
print(latest_changelog)
|
Loading…
Add table
Add a link
Reference in a new issue