[tor-commits] [sbws/maint-1.1] fix: scripts: Stop changing version in __init__

juga at torproject.org juga at torproject.org
Tue Aug 11 13:51:35 UTC 2020


commit b88eb394bdb9b1473289f8899d557fe6a084a139
Author: juga0 <juga at riseup.net>
Date:   Fri Jul 17 12:29:32 2020 +0000

    fix: scripts: Stop changing version in __init__
    
    Since it is now done by `versioneer`.
---
 scripts/maint/release.py | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/scripts/maint/release.py b/scripts/maint/release.py
index ee1c904..fba204e 100755
--- a/scripts/maint/release.py
+++ b/scripts/maint/release.py
@@ -9,8 +9,7 @@ It will:
 1. Ask which version to release
 2. Update the changelog automatically with ``gitchangelog``
    and leave the option to user to manually edit it
-3. Modify the program version to release version,
-   commit it and commit changelog
+3. Commit the changelog
 4. Create a version with the tag and sign it
 5. Push the commit and tag to the repository
 6. Obtain the release tarball
@@ -21,7 +20,6 @@ It will:
 All in sequence and doesn't recover from any previous step.
 
 It assumes that:
-- the program version is in ``__init__.py.__version__``
 - gitchangelog and semantic_version are installed
 - the next prerelease version is the release version + "-dev0"
 - the official tarball releases are at gitlab.torproject.org
@@ -66,15 +64,6 @@ def obtain_release_version(version):
         sys.exit(1)
 
 
-def replace_version(old_version, new_version):
-    with open(sbws.__file__, 'r+') as f:
-        text = f.read()
-        text = re.sub(str(old_version), str(new_version), text)
-        f.seek(0)
-        f.write(text)
-        f.truncate()
-
-
 def obtain_next_prerelease_version(release_version):
     # Assuming that we are only jumping from release to `-dev0`
     next_prerelease_version = semantic_version.Version(
@@ -112,12 +101,9 @@ def main(args):
     print("\nRemoving the tag...")
     subprocess.call(['git', 'tag', '-d', 'v{}'.format(release_version)])
 
-    print("\n3. Modify program version")
+    print("\n3. Commit the changelog")
     print("--------------------------")
-    print("\nReplacing __init__.py version with the release version...")
-    replace_version(current_version, release_version)
-
-    print("\nCommiting __init__.py and CHANGELOG.rst...")
+    print("\nCommiting CHANGELOG.rst...")
     subprocess.call(['git', 'commit',
                      '-am', '"Release version {}."'.format(release_version)])
 





More information about the tor-commits mailing list