Cleanup: format

This commit is contained in:
Campbell Barton 2022-06-29 10:18:24 +10:00
parent e1dc54c8fc
commit 68d037190f
2 changed files with 27 additions and 8 deletions

View File

@ -255,14 +255,14 @@ def api_changelog(args):
with open(indexpath, 'r', encoding='utf-8') as file_handle:
index = json.load(file_handle)
if filepath_in_to == None:
if filepath_in_to is None:
filepath_in_to = index.get(version_key, None)
if filepath_in_to == None:
if filepath_in_to is None:
raise(ValueError("Cannot find API dump file for Blender version " + str(version) + " in index file."))
print("Found to file: %r" % filepath_in_to)
if filepath_in_from == None:
if filepath_in_from is None:
version_from, version_from_key = api_version_previous_in_index(index, version)
if version_from is None:
raise(ValueError("No previous version of Blender could be found in the index."))
@ -423,7 +423,10 @@ def main(argv=None):
help="Path of the JSON file containing the dump of the API.")
parser_dump.set_defaults(func=api_dump)
parser_changelog = parser_commands.add_parser('changelog', help="Generate the RST changelog page based on two Blender Python API JSON dumps.")
parser_changelog = parser_commands.add_parser(
'changelog',
help="Generate the RST changelog page based on two Blender Python API JSON dumps.",
)
parser_changelog.add_argument(
"--filepath-in-from", dest="filepath_in_from", metavar='FILE', default=None,

View File

@ -539,8 +539,10 @@ if ARGS.sphinx_build_pdf:
def generate_changelog():
import importlib.util
spec = importlib.util.spec_from_file_location("sphinx_changelog_gen",
os.path.abspath(os.path.join(SCRIPT_DIR, "sphinx_changelog_gen.py")))
spec = importlib.util.spec_from_file_location(
"sphinx_changelog_gen",
os.path.abspath(os.path.join(SCRIPT_DIR, "sphinx_changelog_gen.py")),
)
sphinx_changelog_gen = importlib.util.module_from_spec(spec)
spec.loader.exec_module(sphinx_changelog_gen)
@ -549,9 +551,23 @@ def generate_changelog():
API_DUMP_FILEPATH = os.path.abspath(os.path.join(API_DUMP_ROOT, BLENDER_VERSION_DOTS, "api_dump.json"))
API_CHANGELOG_FILEPATH = os.path.abspath(os.path.join(SPHINX_IN_TMP, "change_log.rst"))
sphinx_changelog_gen.main(("--", "--indexpath", API_DUMP_INDEX_FILEPATH, "dump", "--filepath-out", API_DUMP_FILEPATH))
sphinx_changelog_gen.main((
"--",
"--indexpath",
API_DUMP_INDEX_FILEPATH,
"dump",
"--filepath-out",
API_DUMP_FILEPATH,
))
sphinx_changelog_gen.main(("--", "--indexpath", API_DUMP_INDEX_FILEPATH, "changelog", "--filepath-out", API_CHANGELOG_FILEPATH))
sphinx_changelog_gen.main((
"--",
"--indexpath",
API_DUMP_INDEX_FILEPATH,
"changelog",
"--filepath-out",
API_CHANGELOG_FILEPATH,
))
# --------------------------------API DUMP--------------------------------------