Use the redirect.b.o website for bug reports

There should be no functional changes on user level, just allows
to more easily do tweaks to the bug report template without worrying
about compatibility with Blender.

With this change it is only GPU, OS, and such are passed to the URL,
without actual text.

Ref infrastructure/blender-projects-platform#78

Pull Request: https://projects.blender.org/blender/blender/pulls/121215
This commit is contained in:
Sergey Sharybin 2024-04-30 14:56:33 +02:00 committed by Sergey Sharybin
parent ca924bf247
commit ad8cb0cff3

@ -9,72 +9,42 @@ def url_prefill_from_blender(*, addon_info=None):
import struct
import platform
import urllib.parse
import io
fh = io.StringIO()
query_params = {"type": "bug_report"}
fh.write("**System Information**\n")
fh.write(
"Operating system: {:s} {:d} Bits".format(
platform.platform(),
struct.calcsize("P") * 8,
)
query_params["project"] = "blender-addons" if addon_info else "blender"
query_params["os"] = "{:s} {:d} Bits".format(
platform.platform(),
struct.calcsize("P") * 8,
)
# Windowing Environment (include when dynamically selectable).
# This lets us know if WAYLAND/X11 is in use.
from _bpy import _ghost_backend
ghost_backend = _ghost_backend()
if ghost_backend not in {'NONE', 'DEFAULT'}:
fh.write(", {:s} UI".format(ghost_backend))
query_params["os"] += (", {:s} UI".format(ghost_backend))
del _ghost_backend, ghost_backend
fh.write("\n")
query_params["gpu"] = "{:s} {:s} {:s}".format(
gpu.platform.renderer_get(),
gpu.platform.vendor_get(),
gpu.platform.version_get(),
)
fh.write(
"Graphics card: {:s} {:s} {:s}\n".format(
gpu.platform.renderer_get(),
gpu.platform.vendor_get(),
gpu.platform.version_get(),
)
)
fh.write(
"\n"
"**Blender Version**\n"
)
fh.write(
"Broken: version: {:s}, branch: {:s}, commit date: {:s} {:s}, hash: `{:s}`\n".format(
bpy.app.version_string,
bpy.app.build_branch.decode('utf-8', 'replace'),
bpy.app.build_commit_date.decode('utf-8', 'replace'),
bpy.app.build_commit_time.decode('utf-8', 'replace'),
bpy.app.build_hash.decode('ascii'),
)
)
fh.write(
"Worked: (newest version of Blender that worked as expected)\n"
query_params["broken_version"] = "{:s}, branch: {:s}, commit date: {:s} {:s}, hash: `{:s}`".format(
bpy.app.version_string,
bpy.app.build_branch.decode('utf-8', 'replace'),
bpy.app.build_commit_date.decode('utf-8', 'replace'),
bpy.app.build_commit_time.decode('utf-8', 'replace'),
bpy.app.build_hash.decode('ascii'),
)
if addon_info:
fh.write(
"\n"
"**Addon Information**\n"
)
fh.write(addon_info)
addon_info_lines = addon_info.splitlines()
query_params["addon_name"] = addon_info_lines[0].removeprefix("Name: ")
query_params["addon_author"] = addon_info_lines[1].removeprefix("Author: ")
fh.write(
"\n"
"**Short description of error**\n"
"[Please fill out a short description of the error here]\n"
"\n"
"**Exact steps for others to reproduce the error**\n"
"[Please describe the exact steps needed to reproduce the issue]\n"
"[Based on the default startup or an attached .blend file (as simple as possible)]\n"
"\n"
)
form_number = 2 if addon_info else 1
return (
"https://developer.blender.org/maniphest/task/edit/form/{:d}?description={:s}".format(
form_number,
urllib.parse.quote(fh.getvalue()),
)
)
query_str = urllib.parse.urlencode(query_params)
return f"https://redirect.blender.org/?{query_str}"