From 5750fb7bf27b96d96affdc70ab15244bac05a8f9 Mon Sep 17 00:00:00 2001 From: Arjan Dikhoff Date: Mon, 14 Oct 2024 18:36:27 +0200 Subject: [PATCH] Pre-release commit storm Before the release, a lot of testing was done, including the ci/cd pipeline. Some of this could only be done in the live environment, which lead to many small commits with bad descriptions Also includes many small fixes in urls and textual changes. Most of it inside migrate.py --- .github/workflows/build_offline_docs.yml | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/sync_class_ref.yml | 5 +- _extensions/gdscript.py | 2 +- _extensions/godot_descriptions.py | 2 +- _templates/versions.html | 14 -- about/complying_with_licenses.rst | 2 +- about/introduction.rst | 3 +- conf.py | 4 +- .../development/code_style_guidelines.rst | 6 +- .../handling_compatibility_breakages.rst | 3 +- favicon.ico | Bin 0 -> 15406 bytes migrate.py | 185 ++++++++++++------ 13 files changed, 142 insertions(+), 88 deletions(-) create mode 100644 favicon.ico diff --git a/.github/workflows/build_offline_docs.yml b/.github/workflows/build_offline_docs.yml index fc47519c9eb..6fff01ce2b6 100644 --- a/.github/workflows/build_offline_docs.yml +++ b/.github/workflows/build_offline_docs.yml @@ -28,7 +28,7 @@ jobs: - name: Migrate to Redot run: | - python migrate.py . _migrated False + python migrate.py . _migrated - name: Sphinx - Build HTML run: make SPHINXOPTS='--color -j 4' SPHINXSOURCEDIR='./_migrated' html diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e3ecbf9571..347815490da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: - name: Migrate to Redot run: | - python migrate.py . _migrated True + python migrate.py . _migrated # Use dummy builder to improve performance as we don't need the generated HTML in this workflow. - name: Sphinx build diff --git a/.github/workflows/sync_class_ref.yml b/.github/workflows/sync_class_ref.yml index 0bf4002fafc..5d7748f14ed 100644 --- a/.github/workflows/sync_class_ref.yml +++ b/.github/workflows/sync_class_ref.yml @@ -19,7 +19,10 @@ jobs: runs-on: ubuntu-latest env: engine_rev: 'master' - + permissions: + contents: write + pull-requests: write + steps: - name: Checkout the documentation repository uses: actions/checkout@v4 diff --git a/_extensions/gdscript.py b/_extensions/gdscript.py index 5da987c462f..6377683cbf7 100644 --- a/_extensions/gdscript.py +++ b/_extensions/gdscript.py @@ -5,7 +5,7 @@ Lexer for GDScript. - :copyright: Copyright 2xxx by The Godot Engine Community + :copyright: Copyright 2xxx by the Redot community, modified from an original work by the G-dot Engine Community :license: MIT. modified by Daniel J. Ramirez based on the original python.py pygment diff --git a/_extensions/godot_descriptions.py b/_extensions/godot_descriptions.py index a59cf3321b5..68f29e4c9ed 100644 --- a/_extensions/godot_descriptions.py +++ b/_extensions/godot_descriptions.py @@ -6,7 +6,7 @@ Sphinx extension to automatically generate HTML meta description tags for all pages. Also comes with some special support for Godot class docs. - :copyright: Copyright 2021 by The Godot Engine Community + :copyright: Copyright 2021 by the Redot community, modified from an original work by the G-dot Engine Community :license: MIT. based on the work of Takayuki Shimizukawa on OpenGraph support for Sphinx, diff --git a/_templates/versions.html b/_templates/versions.html index e46ca819a95..7adccecf2a0 100644 --- a/_templates/versions.html +++ b/_templates/versions.html @@ -34,24 +34,10 @@
{{ slug }}
{% endfor %} -
- {# Translators: The phrase "Read the Docs" is not translated #} -
{{ _('On Read the Docs') }}
-
- {{ _('Project Home') }} -
-
- {{ _('Builds') }} -
-
- {{ _('Downloads') }} -
-

Hosted by Read the Docs - ยท Privacy Policy diff --git a/about/complying_with_licenses.rst b/about/complying_with_licenses.rst index a3a51350ef8..57b3b0bb9be 100644 --- a/about/complying_with_licenses.rst +++ b/about/complying_with_licenses.rst @@ -46,7 +46,7 @@ This text reads as follows:: This game uses Godot Engine, available under the following license: - Copyright (c) 2014-present Godot Engine contributors. + Copyright (c) 2014-present the Redot community, modified from an original work by G-dot Engine contributors. Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/about/introduction.rst b/about/introduction.rst index f6db6b665cc..f11d871fe8a 100644 --- a/about/introduction.rst +++ b/about/introduction.rst @@ -37,8 +37,7 @@ is a great starting point. In case you have trouble with one of the tutorials or your project, you can find help on the various `Community channels `_, -especially the Godot `Discord `_ community and -`Forum `_. +especially the Godot `Discord `_ community. About Godot Engine ------------------ diff --git a/conf.py b/conf.py index 66acf3f531c..4ac076976d4 100644 --- a/conf.py +++ b/conf.py @@ -82,9 +82,9 @@ # General information about the project project = "Godot Engine" copyright = ( - "2014-present Juan Linietsky, Ariel Manzur and the Godot community (CC BY 3.0)" + "2024-present by the Redot community, modified from an original work by Juan Linietsky, Ariel Manzur and the G-dot community (CC BY 3.0)" ) -author = "Juan Linietsky, Ariel Manzur and the Godot community" +author = "the Redot community, modified from an original work by Juan Linietsky, Ariel Manzur and the G-dot community" # Version info for the project, acts as replacement for |version| and |release| # The short X.Y version diff --git a/contributing/development/code_style_guidelines.rst b/contributing/development/code_style_guidelines.rst index 9b475cbbff6..210dd8c7b15 100644 --- a/contributing/development/code_style_guidelines.rst +++ b/contributing/development/code_style_guidelines.rst @@ -177,7 +177,8 @@ Example: /* GODOT ENGINE */ /* https://godotengine.org */ /**************************************************************************/ - /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ + /* Copyright (c) 2014-present the Redot community, modified from an */ + /* original work by G-dot Engine contributors (see AUTHORS.md). */ /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ @@ -222,7 +223,8 @@ Example: /* GODOT ENGINE */ /* https://godotengine.org */ /**************************************************************************/ - /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ + /* Copyright (c) 2014-present the Redot community, modified from an */ + /* original work by Godot Engine contributors (see AUTHORS.md). */ /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ diff --git a/contributing/development/handling_compatibility_breakages.rst b/contributing/development/handling_compatibility_breakages.rst index 3c2ed2e259f..da55a36d2e5 100644 --- a/contributing/development/handling_compatibility_breakages.rst +++ b/contributing/development/handling_compatibility_breakages.rst @@ -57,7 +57,8 @@ like ``core/math/a_star_grid_2d.compat.inc`` in this case: /* GODOT ENGINE */ /* https://godotengine.org */ /**************************************************************************/ - /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ + /* Copyright (c) 2014-present the Redot community, modified from an */ + /* original work by G-dot Engine contributors (see AUTHORS.md). */ /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..919f365ee02923070b209d6909739d75ad46b854 GIT binary patch literal 15406 zcmeI33AA0)8OL|tGejxT6>12A7?#zNnj(4co_k0PQ8NiOR5~b@wr1K2MYTdpTVp9z zVrYzOX-z>5G0!x{5+N2ENsy2{dH3Ai-~T)J+;{GI=f3;Aca^p3taaW!XYX%+)Bg7N zef!(zIXA$yx z*Jgf&mM}VGKu~@{cT3<8cC_`3zz=XmKhg#M@RlGtuccV_H8*W8hz>Ux2W;vRe&{?a z_yI-#_m*OGMa@{l68(UYw5p5{m4C$_qXg0 z{qJ16{|@c@AkSGXMIW~ZexhKJ;TC9IC%HwFF&_bUDt#LPdj{{)U%7Jg9Gw~WMW+f@ zV;K9K8|7Dq?r)KAmXltG`K94=H~9VpIO(NR&&ag9^#KFjw=_m$r9*IE2HYZkFXs1c z`tL@+hclN4>ejQh(FboARbVemrjY&<;6-B&1AcFCUkJ_r04Eu|J=11=h3LnE<@tnU zJhBwP`$u4#sw<3K#gl8h!m~ z_bbBxtZHAQvBmN%H`0HtI$jS&zXkX1*yDca=lLuywY3&X`wIryH?J9+eJPZ7&5lRk zyJW$d@h(3zlsn{>e`@L#&L7O&9E@#0hWxP~%IdAD1cl7EpyQFOg-g-l`&m84ZPBHy z#WsU&7JYmXbM!6l^`MdRXLZ*@r(j)S@um(R*e5nN^Go6@LUep3G#9u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)L0P`QhQRgyV5*s$2`~}9R zY8=vg_8PTdWn%h0Y5K@~Mi$I)wDTQAF}esHy#T!8Zc1jGJMx3_E8O^^ZfjVuoP}sC zz8YMHGfOD+lhVA1x8xhFEU3LJkL4S$nlV9nsv9|rnhs|_inqjSU>*ggYGW06`DOX5 z7vX6#es8SVoop|T%Q^$0&tS}lSH{V%I)oEl9c46PS_5gDnu5{!C3!pNx%Dn;0MMw> zKkIBh{G36J^9K5KmYmkJ>bY~l`vB|hEL%g0DVp0Y_{OE!xvkxLmW^86EsY1~S?F>a zxOA>6-z^z*N20-fBeruo@0!=7PyXf}{1abG*10SX%&jNLho|YtHkc=Ws%z_Pclstk z@m4&J^26bi+O*Y!W;1TKp7C#|Lwi$$Nn$fTT{w_MbDoY9qLqG6WVqJy-a72d2GR8e zwd>d9*EfOlhylcX&PbH|$u5*PYOeVPQNDqBxDUEru_vWF+Qoy;BJX4TPsm9&va!Mu z=P}!WUpWGKh{coIb0_oT(fRoQoO8O0K=K7abTT+JR(3MS)^iX|f~L;-hL~;W{4$Qw z$HC8y+_I~zO(#0b`&Dh>O^t=u7zp~g+ z^anA9yb+%D&6vKqlwD|Co8JKWjxm{v<#)iTHJrAqJYIWh(^%nn2b}+e-m%Qd`X-0+ zYt<&;p#?ug|I<7lWIWchAGIqcDi$bDkd5#?3g7hX&-k05^FDV^{PepI-6IM_>~*>$2OWJqj>ljp5DMe`~$u2XMUqb2Fv^Q1TGtsn#Dsi@hn1yJ3nv$0{=JG!oY-mThn}d0RQRlQ9e8R{nOJ&)Z2IH?uYC^<*l^J~fvGY?;cb(_^$ne}^@>MMDyTN`qzUP4Ul+JE(LuCqM!=Y5XV za;p2+I#Ouwrdnvt9_Dji*WyKc{F*gehkrFwAEW-I{Pv4rM`iJ1wZ9%%?$%Z8+#3Gh z`_ for more. |', 'https://github.com/redot-engine/redot/pull/40364>`_ for more. |'), + # Non existing internal urls + ('https://chat.godotengine.org/', 'https://www.redotengine.org/'), + ('https://editor.godotengine.org', 'https://www.redotengine.org'), + ('https://forum.godotengine.org/', 'https://www.redotengine.org/'), + ('https://fund.godotengine.org', 'https://www.redotengine.org'), # Almost existing urls + ('https://docs.godotengine.org/', '/'), ('https://docs.godotengine.org', 'https://docs.redotengine.org'), ('https://godotengine.org', 'https://redotengine.org'), # Existing urls + ('https://godotengine.org/community', 'https://www.redot.org'), ('https://nightly.link/godotengine/godot-docs/workflows/build_offline_docs/master/godot', 'https://nightly.link/redot-engine/redot-docs/workflows/build_offline_docs/master/redot'), ('https://github.com/godotengine/godot-docs/issues', 'https://github.com/redot-engine/redot-docs/issues'), ('https://github.com/godotengine/godot/blob/master', 'https://github.com/redot-engine/redot/blob/master'), @@ -141,9 +162,10 @@ ('https://github.com/godotengine/godot-proposals', 'https://github.com/redot-engine/redot-proposals'), ('https://raw.githubusercontent.com/godotengine/godot-docs', 'https://raw.githubusercontent.com/redot-engine/redot-docs'), ('https://github.com/godotengine/', 'https://github.com/redot-engine/'), - ('https://chat.godotengine.org/', 'https://discord.gg/a53QyHJZ'), + ('https://chat.godotengine.org/', 'https://discord.gg/redot'), # Generic replacements ('GODOT_COPYRIGHT.txt', 'REDOT_COPYRIGHT.txt'), + ('godotengine.org', 'redotengine.org'), ('godot-docs', 'redot-docs'), ('GODOT ENGINE', 'REDOT ENGINE'), ('/bin/godot', '/bin/redot'), @@ -178,6 +200,16 @@ ('godot.html', 'redot.html'), ('by-godot', 'by-redot'), ('MadeWithGodot', 'MadeWithRedot'), + (' if on_rtd else "(DEV) "', ''), + (' Read the Docs', ' Versions'), + ("const homeUrl = baseUrl.split('/latest/')[0] + '/stable/';", "const homeUrl = 'https://docs-stable.redotengine.org/';"), + ('{% set listed_languages = ({"en":"#", "de":"#", "es":"#", "fr":"#"}).items() -%}', '{% set listed_languages = ({"en":"#"}).items() -%}'), + ('({"stable":"#", "latest":"#"})', '({"stable":"https://docs-stable.redotengine.org/", "latest":"https://docs-latest.redotengine.org/", "3.6":"https://docs-3-6.redotengine.org/"})'), + ('Hosted by Read the Docs', 'Hosted by CloudFlare'), + ('Privacy Policy', ''), + ('G-dot', 'Godot'), + (' godot_', ' redot_'), + ('class_godotsharp', 'class_redotsharp'), ] filename_mappings = [ @@ -214,6 +246,13 @@ def is_target(filename): return any(filename.lower().endswith(m) for m in filename_masks) +def ensureDirExists(outputName): + dirname = os.path.dirname(outputName) + try: + os.makedirs(dirname) + except FileExistsError: + pass + def generateOutputName(root, fileName, outputDirectory): on = os.path.join('.', outputDirectory, root, fileName) on = convertContent(on, filename_mappings) @@ -227,25 +266,18 @@ def convertContent(content, mappings): content = content.replace(search, replace) return content -def ensureDirExists(outputName): - dirname = os.path.dirname(outputName) - try: - os.makedirs(dirname) - except FileExistsError: - pass - -def copyFile(root, filename, outputDirectory): +def copyFile(root, filename, outputDirectory, verbose): inputName = os.path.join(root, filename) outputName = generateOutputName(root, inputName.replace('.\\', '').replace('./', ''), outputDirectory) - print(f'Copying "{inputName}" to "{outputName}"') + if verbose: print(f'Copying "{inputName}" to "{outputName}"') shutil.copyfile(inputName, outputName) -def convertFile(root, filename, outputDirectory, includeUnimplemented): +def convertFile(root, filename, outputDirectory, includeUnimplemented, verbose): inputName = os.path.join(root, filename) outputName = generateOutputName(root, filename, outputDirectory) - print(f'Converting "{inputName}" to "{outputName}"') + if verbose: print(f'Converting "{inputName}" to "{outputName}"') with open(inputName, mode = 'r', encoding = encoding) as input: data = input.read() @@ -256,63 +288,94 @@ def convertFile(root, filename, outputDirectory, includeUnimplemented): with open(outputName, mode = 'w', encoding = encoding) as output: output.write(data) -def copyGlobalDir(inputDirectory, inputMask, outputDirectory): +def copyGlobalDir(inputDirectory, inputMask, outputDirectory, verbose): for root, dirs, files in os.walk(inputDirectory): if (inputMask in root and outputDirectory not in root): for f in files: inputName = os.path.join(root, f) outputName = generateOutputName(root, f, outputDirectory) ensureDirExists(outputName) - print(f"Copying {inputName} to {outputName}") + if verbose: print(f"Copying {inputName} to {outputName}") copyfile(inputName, outputName) -def convertStaticDir(inputDirectory, outputDirectory): +def convertStaticDir(inputDirectory, outputDirectory, verbose): for root, dirs, files in os.walk(inputDirectory): if (outputDirectory not in root and '__' not in root): for f in files: if (f.split('.')[1] in alphanumeric): - convertFile(root, f, outputDirectory, True) + convertFile(root, f, outputDirectory, True, verbose) else: - copyFile(root, f, outputDirectory) + copyFile(root, f, outputDirectory, verbose) -def migrate(inputDirectory, outputDirectory, includeUnimplemented): +def migrate(inputDirectory, outputDirectory, includeUnimplemented, ignoreClasses, verbose): outputsig = os.path.join('.', outputDirectory) for root, dirs, files in os.walk(inputDirectory): # ignore output path if (root.startswith(outputsig)): continue + if (ignoreClasses and 'classes' in root): + continue + items = filter(is_target, files) for item in items: - convertFile(root, item, outputDirectory, includeUnimplemented) - -inputDir = defaultInputDirectory -outputDir = defaultOutputDirectory -includeUnimplemented = defaultIncludeUnimplemented -if (len(sys.argv) > 1): - inputDir = sys.argv[1] -if (len(sys.argv) > 2): - outputDir = sys.argv[2] -if (len(sys.argv) > 3): - includeUnimplemented = sys.argv[3] - -print(f"Simple rst migrator. Uses str.replace to map from Godot to Redot.") -print(f"Usage: py migrate.py [inputDir] [outputDir] [includeUnimplemented], example: py migrate.py . _mymigration True") -print(f"Author: @Craptain on X") -print(f"Input directory: {inputDir}, output directory: {outputDir}, include unimplemented: {includeUnimplemented}") - -migrate(inputDir, outputDir, includeUnimplemented) - -print("Copying config files...") -convertFile(inputDir, 'conf.py', outputDir, includeUnimplemented) -convertFile(inputDir, 'robots.txt', outputDir, includeUnimplemented) -print("Copying static directories...") - -for dir in static_dirs: - if ('**' in dir): - print(f"Copying dirs with mask {dir}") - copyGlobalDir(inputDir, dir.split('/')[1], outputDir) + convertFile(root, item, outputDirectory, includeUnimplemented, verbose) + +def main(): + inputDir = defaultInputDirectory + outputDir = defaultOutputDirectory + includeUnimplemented = defaultIncludeUnimplemented + ignoreClasses = defaultIgnoreClasses + verbose = defaultVerbose + + parser = argparse.ArgumentParser( + prog='Migrate', + description='Simple file migrator. Uses str.replace to map from Godot to Redot. Also converts some filenames.', + epilog='Done. Made by @Craptain') + + parser.add_argument('input', help='Input directory relative to current') + parser.add_argument('output', help='Output directory relative to current') + parser.add_argument('-e', '--extended', action='store_true', help='Include unimplemented substitutions, don\'t use in production') + parser.add_argument('-t', '--tiny', action='store_true', help='Exclude classes directory') + parser.add_argument('-v', '--verbose', action='store_true') + + args = parser.parse_args() + verbose = args.verbose + if (verbose): + print("arguments:") + print(args) + + inputDir = args.input + if (args.output != '.' and not args.output.startswith('/')): + outputDir = args.output else: - print(f"Converting dir {dir}") - convertStaticDir(dir, outputDir) -print("Done") + print("output can't be . or start with /") + exit(1) + includeUnimplemented = args.extended + ignoreClasses = args.tiny + + if (os.path.exists(outputDir)): + print(f"Deleting {outputDir}") + shutil.rmtree(outputDir) + + print("Migrating...") + migrate(inputDir, outputDir, includeUnimplemented, ignoreClasses, verbose) + + print("Copying config files...") + convertFile(inputDir, 'conf.py', outputDir, includeUnimplemented, verbose) + convertFile(inputDir, 'robots.txt', outputDir, includeUnimplemented, verbose) + copyFile(inputDir, 'favicon.ico', outputDir, verbose) + + print("Copying static directories...") + for dir in static_dirs: + if ('**' in dir): + if verbose: print(f"Copying dirs with mask {dir}") + copyGlobalDir(inputDir, dir.split('/')[1], outputDir, verbose) + else: + if verbose: print(f"Converting dir {dir}") + convertStaticDir(dir, outputDir, verbose) + + print(parser.epilog) + +if __name__ == "__main__": + main()