f43be0
# HG changeset patch
f43be0
# User Daniel <daniel@thunderbird.net>
f43be0
# Date 1658184582 0
f43be0
#      Mon Jul 18 22:49:42 2022 +0000
f43be0
# Node ID 9998ed5c2bcee289b03828eba670053614fa26da
f43be0
# Parent  e572bc3cfa07492189aec439e98378b0811ae3bb
f43be0
Bug 1753683 - Replace distutils (deprecated) with packaging. r=rjl
f43be0
f43be0
Differential Revision: https://phabricator.services.mozilla.com/D152123
f43be0
f43be0
diff --git a/comm/python/thirdroc/thirdroc/__init__.py b/comm/python/thirdroc/thirdroc/__init__.py
f43be0
--- a/comm/python/thirdroc/thirdroc/__init__.py
f43be0
+++ b/comm/python/thirdroc/thirdroc/__init__.py
f43be0
@@ -3,11 +3,11 @@
f43be0
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
f43be0
 
f43be0
 from __future__ import print_function, absolute_import
f43be0
 
f43be0
 import re
f43be0
-from distutils.version import StrictVersion
f43be0
+from packaging.version import parse
f43be0
 
f43be0
 VTAG_RE = re.compile(r"^v\d+\.\d+\.\d+$")
f43be0
 
f43be0
 
f43be0
 def tag2version(tag):
f43be0
@@ -22,16 +22,16 @@ def tag2version(tag):
f43be0
         raise Exception("Invalid tag {}".format(tag))
f43be0
 
f43be0
 
f43be0
 def get_latest_version(*versions):
f43be0
     """
f43be0
-    Given a list of versions (that must parse with distutils.version.StrictVersion,
f43be0
+    Given a list of versions (that must parse with packaging.version.parse),
f43be0
     return the latest/newest version.
f43be0
     :param list versions:
f43be0
-    :return StrictVersion:
f43be0
+    :return Version:
f43be0
     """
f43be0
-    version_list = [StrictVersion(tag2version(v)) for v in versions]
f43be0
+    version_list = [parse(tag2version(v)) for v in versions]
f43be0
     version_list.sort()
f43be0
     return version_list[-1]
f43be0
 
f43be0
 
f43be0
 def latest_version(*versions):
f43be0
diff --git a/comm/python/thirdroc/thirdroc/rnp.py b/comm/python/thirdroc/thirdroc/rnp.py
f43be0
--- a/comm/python/thirdroc/thirdroc/rnp.py
f43be0
+++ b/comm/python/thirdroc/thirdroc/rnp.py
f43be0
@@ -6,11 +6,11 @@ from __future__ import absolute_import
f43be0
 
f43be0
 import os
f43be0
 from io import StringIO
f43be0
 from datetime import date
f43be0
 import re
f43be0
-from distutils.version import StrictVersion
f43be0
+from packaging.version import parse
f43be0
 
f43be0
 from mozbuild.preprocessor import Preprocessor
f43be0
 
f43be0
 
f43be0
 def rnp_source_update(rnp_root, version_str, revision, timestamp, bug_report):
f43be0
@@ -21,14 +21,14 @@ def rnp_source_update(rnp_root, version_
f43be0
     :param string version_str: latest version
f43be0
     :param string revision: revision hash (short form)
f43be0
     :param float timestamp: UNIX timestamp from revision
f43be0
     :param string bug_report: where to report bugs for this RNP build
f43be0
     """
f43be0
-    version = StrictVersion(version_str)
f43be0
-    version_major = version.version[0]
f43be0
-    version_minor = version.version[1]
f43be0
-    version_patch = version.version[2]
f43be0
+    version = parse(version_str)
f43be0
+    version_major = version.major
f43be0
+    version_minor = version.minor
f43be0
+    version_patch = version.micro
f43be0
     date_str = date.fromtimestamp(float(timestamp)).strftime("%Y%m%d")
f43be0
     revision_short = revision[:8]
f43be0
     version_full = "{}+git{}.{}.MZLA".format(version_str, date_str, revision_short)
f43be0
 
f43be0
     defines = dict(