This is an automated email from the ASF dual-hosted git repository.

bmahler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new 4f97ac8f4 [post-reviews] Replace deprecated disutil LooseVersion with 
packaging.version.
4f97ac8f4 is described below

commit 4f97ac8f4d2b2c5471f93f8c30d614055a9d5440
Author: None <None>
AuthorDate: Mon May 13 15:33:36 2024 -0400

    [post-reviews] Replace deprecated disutil LooseVersion with 
packaging.version.
    
    This also gets rid of the Deprecation Warning we get when running the
    post-reviews.py script:
    
    ```
    DeprecationWarning: distutils Version classes are deprecated.
    Use packaging.version instead.
      rbt_version = LooseVersion(rbt_version)
    ```
    
    Review: https://reviews.apache.org/r/74984/
---
 support/post-reviews.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/support/post-reviews.py b/support/post-reviews.py
index 799f20d89..0dd566a13 100755
--- a/support/post-reviews.py
+++ b/support/post-reviews.py
@@ -48,7 +48,7 @@ import re
 import sys
 import urllib.parse
 
-from distutils.version import LooseVersion
+from packaging.version import Version
 
 from subprocess import check_output, Popen, PIPE, STDOUT
 
@@ -102,7 +102,7 @@ def main():
 
     rbt_version = execute([rbt_command, '--version'], ignore_errors=True)
     if rbt_version:
-        rbt_version = LooseVersion(rbt_version)
+        rbt_version = Version(rbt_version.split(' ')[1])
         post_review = [rbt_command, 'post']
     elif execute(['post-review', '--version'], ignore_errors=True):
         post_review = ['post-review']
@@ -348,11 +348,11 @@ def main():
 
         # Determine how to specify the revision range.
         if rbt_command in post_review and \
-           rbt_version >= LooseVersion('RBTools 0.6'):
+           rbt_version >= Version('0.6'):
             # rbt >= 0.6.1 supports '--depends-on' argument.
             # Only set the "depends on" if this
             # is not  the first review in the chain.
-            if rbt_version >= LooseVersion('RBTools 0.6.1') and \
+            if rbt_version >= Version('0.6.1') and \
                parent_review_request_id:
                 command = command + ['--depends-on=' + 
parent_review_request_id]
 

Reply via email to