Add Chromium-only Blender WebEngine parity work
This commit is contained in:
18
blender-5.2.0/release/lts/README.md
Normal file
18
blender-5.2.0/release/lts/README.md
Normal file
@@ -0,0 +1,18 @@
|
||||
This folder contains a script to generate release notes and download URLs
|
||||
for Blender LTS releases.
|
||||
|
||||
Ensure required Python modules are installed before running:
|
||||
|
||||
pip3 install -r ./requirements.txt
|
||||
|
||||
Then run for example:
|
||||
|
||||
./create_release_notes.py --version 3.3.2 --format=html
|
||||
|
||||
Available arguments:
|
||||
|
||||
--version VERSION Version string in the form of {major}.{minor}.{build}
|
||||
(e.g. 3.3.2)
|
||||
--issue ISSUE Gitea issue that is contains the release notes
|
||||
information (e.g. #77348)
|
||||
--format FORMAT Format the result in `text`, `steam`, `wiki` or `html`
|
||||
66
blender-5.2.0/release/lts/create_release_notes.py
Executable file
66
blender-5.2.0/release/lts/create_release_notes.py
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-FileCopyrightText: 2020-2023 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
"""
|
||||
This python script is used to generate the release notes and
|
||||
download URLs which we can copy-paste directly into the CMS of
|
||||
www.blender.org and stores.
|
||||
"""
|
||||
__all__ = (
|
||||
"main",
|
||||
)
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
import lts_issue
|
||||
import lts_download
|
||||
|
||||
|
||||
def main() -> int:
|
||||
# Parse arguments
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument(
|
||||
"--version",
|
||||
required=True,
|
||||
help="Version string in the form of {major}.{minor}.{patch} (e.g. 3.3.2)")
|
||||
parser.add_argument(
|
||||
"--issue",
|
||||
help="Task that contains the release notes information (e.g. #77348)")
|
||||
parser.add_argument(
|
||||
"--format",
|
||||
help="Format the result in `text`, `steam`, `markdown` or `html`",
|
||||
default="text")
|
||||
args = parser.parse_args()
|
||||
|
||||
# Determine issue number
|
||||
version = args.version
|
||||
issue = args.issue
|
||||
if not issue:
|
||||
if version.startswith("2.83."):
|
||||
issue = "#77348"
|
||||
elif version.startswith("2.93."):
|
||||
issue = "#88449"
|
||||
elif version.startswith("3.3."):
|
||||
issue = "#100749"
|
||||
elif version.startswith("3.6."):
|
||||
issue = "#109399"
|
||||
elif version.startswith("4.2."):
|
||||
issue = "#124452"
|
||||
elif version.startswith("4.5."):
|
||||
issue = "#141871"
|
||||
else:
|
||||
raise ValueError("Specify --issue or update script to include issue number for this version")
|
||||
|
||||
# Print
|
||||
if args.format == "html":
|
||||
lts_download.print_urls(version=version)
|
||||
print("")
|
||||
|
||||
lts_issue.print_notes(version=version, format=args.format, issue=issue)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
70
blender-5.2.0/release/lts/lts_download.py
Normal file
70
blender-5.2.0/release/lts/lts_download.py
Normal file
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-FileCopyrightText: 2020-2023 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
__all__ = (
|
||||
"print_urls",
|
||||
)
|
||||
|
||||
import datetime
|
||||
|
||||
|
||||
# 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}-linux-x64.tar.xz", "Linux")
|
||||
yield (f"blender-{version}-macos-x64.dmg", "macOS - Intel")
|
||||
yield (f"blender-{version}-macos-arm64.dmg", "macOS - Apple Silicon")
|
||||
yield (f"blender-{version}-windows-x64.msi", "Windows - Installer")
|
||||
yield (f"blender-{version}-windows-x64.zip", "Windows - Portable (.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/release/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, display_name in get_download_file_names(version):
|
||||
download_url = get_download_url(version, file_name)
|
||||
lines.append(f" <li><a href=\"{download_url}\">{display_name}</a></li>")
|
||||
lines.append("</ul>")
|
||||
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def print_urls(version: str):
|
||||
"""
|
||||
Generate the download urls and print them to the console.
|
||||
"""
|
||||
print(generate_html(Version(version)))
|
||||
174
blender-5.2.0/release/lts/lts_issue.py
Normal file
174
blender-5.2.0/release/lts/lts_issue.py
Normal file
@@ -0,0 +1,174 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
__all__ = (
|
||||
"print_notes",
|
||||
)
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
class ReleaseLogLine:
|
||||
"""
|
||||
Class containing the information of a single line of the release log
|
||||
|
||||
Instance attributes:
|
||||
|
||||
* line: (str) the original line used to create this log line
|
||||
* issue_id: (int or None) the extracted issue id associated with this log
|
||||
line. Can be None if the log line isn't associated with a issue.
|
||||
* commit_id: (str or None) the extracted commit id associated with this log
|
||||
line. Only filled when no ``issue_id`` could be found.
|
||||
* ref: (str) ``issue_id`` or ``commit_id`` of this line, including ``T`` for issues
|
||||
or ``D`` for diffs.
|
||||
* title: (str) title of this log line. When constructed this attribute is
|
||||
an empty string. The called needs to retrieve the title from the
|
||||
backend.
|
||||
* url: (str) url of the ticket issue or commit.
|
||||
"""
|
||||
|
||||
def __init__(self, line: str):
|
||||
self.line = line
|
||||
items = line.split("|")
|
||||
self.issue_id = None
|
||||
self.issue_repo = None
|
||||
self.commit_id = None
|
||||
self.commit_repo = None
|
||||
base_url = "https://projects.blender.org"
|
||||
try:
|
||||
issue_tokens = items[1].strip().split("#")
|
||||
if len(issue_tokens[0]) > 0:
|
||||
self.issue_repo = issue_tokens[0]
|
||||
self.issue_id = issue_tokens[1]
|
||||
else:
|
||||
self.issue_repo = "blender/blender"
|
||||
self.issue_id = issue_tokens[1]
|
||||
|
||||
self.ref = f"#{self.issue_id}"
|
||||
self.url = f"{base_url}/{self.issue_repo}/issues/{self.issue_id}"
|
||||
except IndexError:
|
||||
# no issue
|
||||
commit_string = items[3].strip()
|
||||
commit_string = commit_string.split(",")[0]
|
||||
commit_string = commit_string.split("]")[0]
|
||||
commit_string = commit_string.replace("[", "")
|
||||
|
||||
commit_tokens = commit_string.split("@")
|
||||
if len(commit_tokens) > 1:
|
||||
self.commit_repo = commit_tokens[0]
|
||||
self.commit_id = commit_tokens[1]
|
||||
else:
|
||||
self.commit_repo = "blender/blender"
|
||||
self.commit_id = commit_tokens[0]
|
||||
|
||||
self.ref = f"{self.commit_id}"
|
||||
self.url = f"{base_url}/{self.commit_repo}/commit/{self.commit_id}"
|
||||
|
||||
self.title = ""
|
||||
|
||||
def __format_as_html(self) -> str:
|
||||
return f" <li>{self.title} [<a href=\"{self.url}\">{self.ref}</a>]</li>"
|
||||
|
||||
def __format_as_text(self) -> str:
|
||||
return f"* {self.title} [{self.ref}]"
|
||||
|
||||
def __format_as_steam(self) -> str:
|
||||
return f"* {self.title} ([url={self.url}]{self.ref}[/url])"
|
||||
|
||||
def __format_as_markdown(self) -> str:
|
||||
if self.issue_id:
|
||||
return f"* {self.title} ({self.issue_repo}#{self.issue_id})"
|
||||
else:
|
||||
return f"* {self.title} ({self.commit_repo}@{self.commit_id})"
|
||||
|
||||
def format(self, format: str) -> str:
|
||||
"""
|
||||
Format this line
|
||||
|
||||
:attr format: the desired format. Possible values are 'text', 'steam' or 'html'
|
||||
:type string:
|
||||
"""
|
||||
if format == 'html':
|
||||
return self.__format_as_html()
|
||||
elif format == 'steam':
|
||||
return self.__format_as_steam()
|
||||
elif format == 'markdown':
|
||||
return self.__format_as_markdown()
|
||||
else:
|
||||
return self.__format_as_text()
|
||||
|
||||
|
||||
def format_title(title: str) -> str:
|
||||
title = title.strip()
|
||||
if not title.endswith("."):
|
||||
title = title + "."
|
||||
return title
|
||||
|
||||
|
||||
def extract_release_notes(version: str, issue: str):
|
||||
"""
|
||||
Extract all release notes logs
|
||||
|
||||
# Process
|
||||
|
||||
1. Retrieval of description of the given `issue_id`.
|
||||
2. Find rows for the given `version` and convert to `ReleaseLogLine`.
|
||||
3. based on the associated issue or commit retrieves the title of the log
|
||||
line.
|
||||
"""
|
||||
base_url = "https://projects.blender.org/api/v1/repos"
|
||||
issues_url = base_url + "/blender/blender/issues/"
|
||||
headers = {'accept': 'application/json'}
|
||||
|
||||
response = requests.get(issues_url + issue[1:], headers=headers)
|
||||
description = response.json()["body"]
|
||||
|
||||
lines = description.split("\n")
|
||||
start_index = lines.index(f"## Blender {version}")
|
||||
lines = lines[start_index + 1:]
|
||||
for line in lines:
|
||||
if not line.strip():
|
||||
continue
|
||||
if line.startswith("| **Report**"):
|
||||
continue
|
||||
if line.startswith("## Blender"):
|
||||
break
|
||||
if line.find("| -- |") != -1:
|
||||
continue
|
||||
|
||||
log_line = ReleaseLogLine(line)
|
||||
if log_line.issue_id:
|
||||
issue_url = f"{base_url}/{log_line.issue_repo}/issues/{log_line.issue_id}"
|
||||
response = requests.get(issue_url, headers=headers)
|
||||
if response.status_code != 200:
|
||||
raise ValueError("Issue not found: " + str(log_line.issue_id))
|
||||
|
||||
log_line.title = format_title(response.json()["title"])
|
||||
yield log_line
|
||||
elif log_line.commit_id:
|
||||
commit_url = f"{base_url}/{log_line.commit_repo}/git/commits/{log_line.commit_id}"
|
||||
response = requests.get(commit_url, headers=headers)
|
||||
if response.status_code != 200:
|
||||
raise ValueError("Commit not found: " + log_line.commit_id)
|
||||
|
||||
commit_message = response.json()['commit']['message']
|
||||
commit_title = commit_message.split("\n")[0]
|
||||
log_line.title = format_title(commit_title)
|
||||
yield log_line
|
||||
|
||||
|
||||
def print_notes(version: str, format: str, issue: str):
|
||||
"""
|
||||
Generate and print the release notes to the console.
|
||||
"""
|
||||
if format == 'html':
|
||||
print("<ul>")
|
||||
if format == 'steam':
|
||||
print("[ul]")
|
||||
for log_item in extract_release_notes(version=version, issue=issue):
|
||||
print(log_item.format(format=format))
|
||||
if format == 'html':
|
||||
print("</ul>")
|
||||
if format == 'steam':
|
||||
print("[/ul]")
|
||||
1
blender-5.2.0/release/lts/requirements.txt
Normal file
1
blender-5.2.0/release/lts/requirements.txt
Normal file
@@ -0,0 +1 @@
|
||||
requests
|
||||
Reference in New Issue
Block a user