[asterisk-commits] Removed "leading one" functionality (repotools[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Mar 29 11:31:50 CDT 2016
Joshua Colp has submitted this change and it was merged.
Change subject: Removed "leading_one" functionality
......................................................................
Removed "leading_one" functionality
The "leading_one" was in place in order to be backwards compatible with older
Asterisk versions (<=1.8). Since we are no longer doing releases of those
versions and it interferes with libpri and libss7 releases this functionality
has been removed.
Change-Id: I93cd7aae7b86b0fab186d5310543bb297ff23412
---
M version_parser.py
1 file changed, 3 insertions(+), 32 deletions(-)
Approvals:
Mark Michelson: Looks good to me, approved
Joshua Colp: Looks good to me, but someone else must approve; Verified
diff --git a/version_parser.py b/version_parser.py
index bb4e88f..7e2c5ac 100644
--- a/version_parser.py
+++ b/version_parser.py
@@ -18,9 +18,6 @@
Attributes:
raw - The raw version string
prefix - A tag prefix, such as 'certified'
- leading_one - Whether the major version was preceeded by a '1'. This is
- for compatibility with older versions of Asterisk, such
- as 1.8.
major - The semantic major version
minor - The semantic minor version
patch - The semantic patch version. -1 if there is no patch version.
@@ -38,7 +35,6 @@
raw - The raw string representation of the version
"""
prefix = None
- leading_one = None
modifiers = []
ver_modifiers = []
@@ -59,10 +55,6 @@
# Parse out the major/minor digits, handling the case where we have
# a leading '1' digit
start_index = 0
- if version_parts[0] == '1':
- leading_one = True
- start_index = 1
-
major = int(version_parts[start_index])
minor = int(version_parts[start_index + 1])
if len(version_parts) > 2:
@@ -81,12 +73,11 @@
int(modifier[digit_pos.start():])))
ver = AsteriskVersion(major, minor, patch=patch, modifiers=modifiers,
- prefix=prefix, leading_one=leading_one)
+ prefix=prefix)
ver.raw = raw
return ver
- def __init__(self, major, minor, patch=-1, modifiers=None, prefix=None,
- leading_one=False):
+ def __init__(self, major, minor, patch=-1, modifiers=None, prefix=None):
"""Constructor
Keyword Arguments:
@@ -99,16 +90,12 @@
version suffix, i.e., 'rc3'. Any number may be included,
delineated by a '-'.
prefix - A tag prefix, such as 'certified'
- leading_one - Whether the major version was preceeded by a '1'. This
- is for compatibility with older versions of Asterisk,
- such as 1.8.
"""
self.major = major
self.minor = minor
self.patch = patch
self.modifiers = modifiers or []
self.prefix = prefix
- self.leading_one = leading_one
def get_previous_version(self):
"""Return the logical previous version of this version
@@ -123,7 +110,7 @@
previous = AsteriskVersion(self.major, self.minor,
patch=self.patch, modifiers=list(self.modifiers),
- prefix=self.prefix, leading_one=self.leading_one)
+ prefix=self.prefix)
for i, modifier in enumerate(reversed(previous.modifiers)):
prefix, num = modifier
@@ -158,9 +145,6 @@
if self.prefix:
ver = '{0}/'.format(self.prefix)
- if self.leading_one:
- ver = '{0}1.'.format(ver)
-
ver = '{0}{1}.{2}'.format(ver, self.major, self.minor)
if self.patch > -1:
@@ -178,7 +162,6 @@
def test_parse_18(self):
"""Test parsing a 1.8 (leading one) version string"""
ver = AsteriskVersion.create_from_string('1.8.23.0')
- self.assertTrue(ver.leading_one)
self.assertEqual(ver.major, 8)
self.assertEqual(ver.minor, 23)
self.assertEqual(ver.patch, 0)
@@ -188,7 +171,6 @@
def test_parse_18_patch(self):
"""Test parsing a 1.8 version with a patch number"""
ver = AsteriskVersion.create_from_string('1.8.23.2')
- self.assertTrue(ver.leading_one)
self.assertEqual(ver.major, 8)
self.assertEqual(ver.minor, 23)
self.assertEqual(ver.patch, 2)
@@ -198,7 +180,6 @@
def test_parse_11(self):
"""Test parsing an 11 (non-leading one) version string"""
ver = AsteriskVersion.create_from_string('11.17.0')
- self.assertFalse(ver.leading_one)
self.assertEqual(ver.major, 11)
self.assertEqual(ver.minor, 17)
self.assertEqual(ver.patch, 0)
@@ -209,7 +190,6 @@
"""Test parsing an 11 version string with patch"""
ver = AsteriskVersion.create_from_string('11.17.11')
self.assertEqual(ver.prefix, None)
- self.assertFalse(ver.leading_one)
self.assertEqual(ver.major, 11)
self.assertEqual(ver.minor, 17)
self.assertEqual(ver.patch, 11)
@@ -220,7 +200,6 @@
"""Test parsing a 1.8 version with an rc1"""
ver = AsteriskVersion.create_from_string('1.8.23.0-rc1')
self.assertEqual(ver.prefix, None)
- self.assertTrue(ver.leading_one)
self.assertEqual(ver.major, 8)
self.assertEqual(ver.minor, 23)
self.assertEqual(ver.patch, 0)
@@ -233,7 +212,6 @@
"""Test parsing a 11 version with a non-rc1"""
ver = AsteriskVersion.create_from_string('11.17.0-rc3')
self.assertEqual(ver.prefix, None)
- self.assertFalse(ver.leading_one)
self.assertEqual(ver.major, 11)
self.assertEqual(ver.minor, 17)
self.assertEqual(ver.patch, 0)
@@ -246,7 +224,6 @@
"""Test parsing a 1.8 non-beta1 version"""
ver = AsteriskVersion.create_from_string('1.8.23.0-beta2')
self.assertEqual(ver.prefix, None)
- self.assertTrue(ver.leading_one)
self.assertEqual(ver.major, 8)
self.assertEqual(ver.minor, 23)
self.assertEqual(ver.patch, 0)
@@ -259,7 +236,6 @@
"""Test parsing an 11 beta1 version"""
ver = AsteriskVersion.create_from_string('11.17.0-beta1')
self.assertEqual(ver.prefix, None)
- self.assertFalse(ver.leading_one)
self.assertEqual(ver.major, 11)
self.assertEqual(ver.minor, 17)
self.assertEqual(ver.patch, 0)
@@ -272,7 +248,6 @@
"""Test parsing a 1.8 beta1 rc"""
ver = AsteriskVersion.create_from_string('1.8.0.0-beta1-rc3')
self.assertEqual(ver.prefix, None)
- self.assertTrue(ver.leading_one)
self.assertEqual(ver.major, 8)
self.assertEqual(ver.minor, 0)
self.assertEqual(ver.patch, 0)
@@ -288,7 +263,6 @@
"""Test parsing an 11 beta rc1"""
ver = AsteriskVersion.create_from_string('11.0.0-beta3-rc1')
self.assertEqual(ver.prefix, None)
- self.assertFalse(ver.leading_one)
self.assertEqual(ver.major, 11)
self.assertEqual(ver.minor, 0)
self.assertEqual(ver.patch, 0)
@@ -303,7 +277,6 @@
def test_cert_13(self):
"""Test parsing 13.1-cert1"""
ver = AsteriskVersion.create_from_string('certified/13.1-cert1')
- self.assertFalse(ver.leading_one)
self.assertEqual(ver.prefix, 'certified')
self.assertEqual(ver.major, 13)
self.assertEqual(ver.minor, 1)
@@ -316,7 +289,6 @@
def test_cert_13_rc(self):
"""Test parsing 13.1-cert with a high rc"""
ver = AsteriskVersion.create_from_string('certified/13.1-cert12-rc10')
- self.assertFalse(ver.leading_one)
self.assertEqual(ver.prefix, 'certified')
self.assertEqual(ver.major, 13)
self.assertEqual(ver.minor, 1)
@@ -361,7 +333,6 @@
ver = AsteriskVersion.create_from_string('1.8.19.3')
prev = ver.get_previous_version()
self.assertEqual(prev.prefix, None)
- self.assertTrue(prev.leading_one)
self.assertEqual(prev.major, 8)
self.assertEqual(prev.minor, 19)
self.assertEqual(prev.patch, 2)
--
To view, visit https://gerrit.asterisk.org/2462
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I93cd7aae7b86b0fab186d5310543bb297ff23412
Gerrit-PatchSet: 1
Gerrit-Project: repotools
Gerrit-Branch: master
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
More information about the asterisk-commits
mailing list