post_version.py: update the files in the current worktree, not the one with the scrip...
[mesa.git] / bin / post_version.py
index 553a121714a98de590093a544c16173ad1b055cb..328a48b26049021b8d59125019b3c4c6dd4816ab 100755 (executable)
@@ -26,35 +26,8 @@ import pathlib
 import subprocess
 
 
-def update_homepage(version: str) -> None:
-    p = pathlib.Path(__file__).parent.parent / 'docs' / 'conf.py'
-
-    # Don't post release candidates to the homepage
-    if 'rc' in version:
-        return
-
-    with open(p, 'r') as f:
-        conf = f.readlines()
-
-    new_conf = []
-    for line in conf:
-        if line.startswith("version = '") and line.endswith("'\n"):
-            old_version = line.split("'")[1]
-            # Avoid overwriting 20.1.0 when releasing 20.0.8
-            # TODO: we might need more than that to handle 20.0.10
-            if old_version < version:
-                line = f"version = '{version}'\n"
-        new_conf.append(line)
-
-    with open(p, 'w') as f:
-        for line in new_conf:
-            f.write(line)
-
-    subprocess.run(['git', 'add', p])
-
-
 def update_release_notes(version: str) -> None:
-    p = pathlib.Path(__file__).parent.parent / 'docs' / 'relnotes.rst'
+    p = pathlib.Path('docs') / 'relnotes.rst'
 
     with open(p, 'r') as f:
         relnotes = f.readlines()
@@ -75,7 +48,7 @@ def update_release_notes(version: str) -> None:
 
 
 def update_calendar(version: str) -> None:
-    p = pathlib.Path(__file__).parent.parent / 'docs' / 'release-calendar.rst'
+    p = pathlib.Path('docs') / 'release-calendar.rst'
 
     with open(p, 'r') as f:
         calendar = f.readlines()
@@ -108,14 +81,12 @@ def main() -> None:
     parser.add_argument('version', help="The released version.")
     args = parser.parse_args()
 
-    update_homepage(args.version)
     update_calendar(args.version)
     done = 'update calendar'
 
-    if not is_release_candidate(args.version):
-        update_index(args.version)
+    if 'rc' not in args.version:
         update_release_notes(args.version)
-        done += ', add news item, and link releases notes'
+        done += ' and link releases notes'
 
     subprocess.run(['git', 'commit', '-m',
                     f'docs: {done} for {args.version}'])