This patch contains 2 scripts that will help with LTS releases
create_download_urls.py
This python script is used to generate the download urls which we can
copy-paste directly into the CMS of www.blender.org.
Usage: create_download_urls.py --version 2.83.7
Arguments:
--version VERSION Version string in the form of {major}.{minor}.{build}
(eg 2.83.7)
The resulting html will be printed to the console.
create_release_notes.py
=======================
This python script is used to generate the release notes which we can
copy-paste directly into the CMS of www.blender.org and stores.
Usage: ./create_release_notes.py --task=T77348 --version=2.83.7
Arguments:
--version VERSION Version string in the form of {major}.{minor}.{build}
(e.g. 2.83.7)
--task TASK Phabricator ticket that is contains the release notes
information (e.g. T77348)
--format FORMAT Format the result in `text`, `steam`, `wiki` or `html`
Requirements
============
* Python 3.8 or later
* Python phabricator client version 0.7.0
https://pypi.org/project/phabricator/
For convenience the python modules can be installed using pip.
pip3 install -r ./requirements.txt
Differential Revision: https://developer.blender.org/D9055
79 lines
2.2 KiB
Python
Executable File
79 lines
2.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import argparse
|
|
import datetime
|
|
|
|
|
|
DESCRIPTION = ("This python script is used to generate the download urls "
|
|
"which we can copy-paste directly into the CMS of "
|
|
"www.blender.org")
|
|
USAGE = "create_download_urls --version=2.83.7"
|
|
# Used date format: "September 30, 2020"
|
|
DATE_FORMAT = "%B %d, %Y"
|
|
|
|
|
|
class Version:
|
|
"""
|
|
Version class that extracts the major, minor and build from
|
|
a version string
|
|
"""
|
|
def __init__(self, version: str):
|
|
self.version = version
|
|
v = version.split(".")
|
|
self.major = v[0]
|
|
self.minor = v[1]
|
|
self.build = v[2]
|
|
|
|
def __str__(self) -> str:
|
|
return self.version
|
|
|
|
|
|
def get_download_file_names(version: Version):
|
|
yield f"blender-{version}-linux64.tar.xz"
|
|
yield f"blender-{version}-macOS.dmg"
|
|
yield f"blender-{version}-windows64.msi"
|
|
yield f"blender-{version}-windows64.zip"
|
|
|
|
|
|
def get_download_url(version: Version, file_name: str) -> str:
|
|
"""
|
|
Get the download url for the given version and file_name
|
|
"""
|
|
return (f"https://www.blender.org/download/Blender{version.major}"
|
|
f".{version.minor}/{file_name}")
|
|
|
|
|
|
def generate_html(version: Version) -> str:
|
|
"""
|
|
Generate download urls and format them into an HTML string
|
|
"""
|
|
today = datetime.date.today()
|
|
lines = []
|
|
lines.append(f"Released on {today.strftime(DATE_FORMAT)}.")
|
|
lines.append("")
|
|
lines.append("<ul>")
|
|
for file_name in get_download_file_names(version):
|
|
download_url = get_download_url(version, file_name)
|
|
lines.append(f" <li><a href=\"{download_url}\">{file_name}</a></li>")
|
|
lines.append("</ul>")
|
|
|
|
return "\n".join(lines)
|
|
|
|
|
|
def print_download_urls(version: Version):
|
|
"""
|
|
Generate the download urls and print them to the console.
|
|
"""
|
|
print(generate_html(version))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
parser = argparse.ArgumentParser(description=DESCRIPTION, usage=USAGE)
|
|
parser.add_argument("--version",
|
|
required=True,
|
|
help=("Version string in the form of {major}.{minor}."
|
|
"{build} (eg 2.83.7)"))
|
|
args = parser.parse_args()
|
|
|
|
print_download_urls(version=Version(args.version))
|