From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 3F7E91395E2 for ; Mon, 5 Dec 2016 05:14:38 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 71CF621C330; Mon, 5 Dec 2016 05:14:37 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1D0F221C343 for ; Mon, 5 Dec 2016 05:14:37 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E2BE134102B for ; Mon, 5 Dec 2016 05:14:35 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1410924B8 for ; Mon, 5 Dec 2016 05:14:34 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1480914795.0473d6bc3b879fa5ce8182c7e241122cb93887d3.dolsen@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/versions.py X-VCS-Directories: pym/portage/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 0473d6bc3b879fa5ce8182c7e241122cb93887d3 X-VCS-Branch: master Date: Mon, 5 Dec 2016 05:14:34 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 96f59f20-f738-4b98-922b-aa9e1042a25b X-Archives-Hash: 522ce287d9dd3f248fee9dd17a37fbf8 commit: 0473d6bc3b879fa5ce8182c7e241122cb93887d3 Author: Brian Dolbec gentoo org> AuthorDate: Wed Nov 30 02:58:28 2016 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Mon Dec 5 05:13:15 2016 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0473d6bc portage/versions.py: Pyflakes and Whitespace cleanup pym/portage/versions.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/pym/portage/versions.py b/pym/portage/versions.py index 1ca9a36..a028d93 100644 --- a/pym/portage/versions.py +++ b/pym/portage/versions.py @@ -127,7 +127,7 @@ def vercmp(ver1, ver2, silent=1): positive number >>> vercmp('1.0_p3','1.0_p3') 0 - + @param pkg1: version to compare with (see ver_regexp in portage.versions.py) @type pkg1: string (example: "2.1.2-r3") @param pkg2: version to compare againts (see ver_regexp in portage.versions.py) @@ -135,7 +135,7 @@ def vercmp(ver1, ver2, silent=1): @rtype: None or float @return: 1. positive if ver1 is greater than ver2 - 2. negative if ver1 is less than ver2 + 2. negative if ver1 is less than ver2 3. 0 if ver1 equals ver2 4. None if ver1 or ver2 are invalid (see ver_regexp in portage.versions.py) """ @@ -145,7 +145,7 @@ def vercmp(ver1, ver2, silent=1): match1 = ver_regexp.match(ver1) match2 = ver_regexp.match(ver2) - + # checking that the versions are valid if not match1 or not match1.groups(): if not silent: @@ -161,7 +161,7 @@ def vercmp(ver1, ver2, silent=1): return 1 elif match2.group(1) and not match1.group(1): return -1 - + # building lists of the version parts before the suffix # first part is simple list1 = [int(match1.group(2))] @@ -225,7 +225,7 @@ def vercmp(ver1, ver2, silent=1): # main version is equal, so now compare the _suffix part list1 = match1.group(6).split("_")[1:] list2 = match2.group(6).split("_")[1:] - + for i in range(0, max(len(list1), len(list2))): # Implicit _p0 is given a value of -1, so that 1 < 1_p0 if len(list1) <= i: @@ -267,7 +267,7 @@ def vercmp(ver1, ver2, silent=1): r2 = 0 rval = (r1 > r2) - (r1 < r2) return rval - + def pkgcmp(pkg1, pkg2): """ Compare 2 package versions created in pkgsplit format. @@ -284,10 +284,10 @@ def pkgcmp(pkg1, pkg2): @param pkg2: package to compare againts @type pkg2: list (example: ['test', '1.0', 'r1']) @rtype: None or integer - @return: + @return: 1. None if package names are not the same 2. 1 if pkg1 is greater than pkg2 - 3. -1 if pkg1 is less than pkg2 + 3. -1 if pkg1 is less than pkg2 4. 0 if pkg1 equals pkg2 """ if pkg1[0] != pkg2[0]: @@ -314,7 +314,7 @@ def _pkgsplit(mypkg, eapi=None): rev = '0' rev = 'r' + rev - return (m.group('pn'), m.group('ver'), rev) + return (m.group('pn'), m.group('ver'), rev) _cat_re = re.compile('^%s$' % _cat, re.UNICODE) _missing_cat = 'null' @@ -322,9 +322,9 @@ _missing_cat = 'null' def catpkgsplit(mydata, silent=1, eapi=None): """ Takes a Category/Package-Version-Rev and returns a list of each. - + @param mydata: Data to split - @type mydata: string + @type mydata: string @param silent: suppress error messages @type silent: Boolean (integer) @rype: list @@ -449,7 +449,6 @@ class _pkg_str(_unicode): return self._stable except AttributeError: try: - metadata = self._metadata settings = self._settings except AttributeError: raise AttributeError('stable')