[+] Deploy tool: Automatically update help page and regenerate man

This commit is contained in:
Azalea (on HyDEV-Daisy) 2022-09-06 11:30:51 -04:00
parent 31f50d38ee
commit 92ae4b4316
No known key found for this signature in database
GPG key ID: E289FAC0DA92DD2B
3 changed files with 30 additions and 6 deletions

View file

@ -69,6 +69,25 @@ def edit_versions(version: str):
path.write_text('\n'.join(lines)) path.write_text('\n'.join(lines))
def finalize_neofetch():
"""
Finalize current version
"""
# 1. Update distro list
path = Path('neofetch')
content = path.read_text()
content = re.compile(r'(?<=# Flag: --ascii_distro\n#\n).*?(?=ascii_distro=)', re.DOTALL)\
.sub(generate_help(100, '# ') + '\n', content)
content = re.compile(r"""(?<=Which Distro's ascii art to print\n\n).*?{distro}_small to use them\.""", re.DOTALL)\
.sub(generate_help(100, ' ' * 32), content)
path.write_text(content)
# 2. Regenerate man page
Path('neofetch.1').write_text(subprocess.check_output(['help2man', './neofetch']).decode())
# 3. Reformat readme links
reformat_readme()
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser(description='HyFetch Release Utility') parser = argparse.ArgumentParser(description='HyFetch Release Utility')
parser.add_argument('version', help='Version to release') parser.add_argument('version', help='Version to release')
@ -77,4 +96,5 @@ if __name__ == '__main__':
pre_check() pre_check()
edit_versions(args.version) edit_versions(args.version)
finalize_neofetch()

View file

@ -1,10 +1,10 @@
### Things to do before deploying... ### Things to do before deploying...
* [ ] Check file permissions (+x) * [x] Check file permissions (+x)
* [ ] Update version numbers (`README.md`, `package.json`, `hyfetch/constants.py`, `neofetch`) * [x] Check Shellcheck (should be automatic)
* [ ] Check Shellcheck (should be automatic) * [x] Update version numbers (`README.md`, `package.json`, `hyfetch/constants.py`, `neofetch`)
* [ ] Update distro list in neofetch help (`tools/list_distros.py`) * [x] Update distro list in neofetch help (`tools/list_distros.py`)
* [ ] Regenerate man page (`help2man ./neofetch > neofetch.1`) * [x] Regenerate man page (`help2man ./neofetch > neofetch.1`)
* [ ] Create an RC release and deploy to pypi, try installing and testing on many distros. * [ ] Create an RC release and deploy to pypi, try installing and testing on many distros.
* [ ] Change back to stable release, create tag, create GitHub release * [ ] Change back to stable release, create tag, create GitHub release
* [ ] Formally deploy to pypi and npm (`tools/deploy.sh`, `npm publish`) * [ ] Formally deploy to pypi and npm (`tools/deploy.sh`, `npm publish`)

View file

@ -10,7 +10,7 @@ from pathlib import Path
RE_SHORTHAND = re.compile(r"""[a-z0-9]+?/[a-z0-9]+?#[0-9]+""") RE_SHORTHAND = re.compile(r"""[a-z0-9]+?/[a-z0-9]+?#[0-9]+""")
if __name__ == '__main__': def reformat_readme():
readme = Path('README.md').read_text() readme = Path('README.md').read_text()
for shorthand in RE_SHORTHAND.findall(readme): for shorthand in RE_SHORTHAND.findall(readme):
@ -19,3 +19,7 @@ if __name__ == '__main__':
readme = readme.replace(shorthand, f'[{user}#{pull}](https://github.com/{user}/{repo}/pull/{pull})') readme = readme.replace(shorthand, f'[{user}#{pull}](https://github.com/{user}/{repo}/pull/{pull})')
Path('README.md').write_text(readme) Path('README.md').write_text(readme)
if __name__ == '__main__':
reformat_readme()