From b87e4c08249fe68c9356858997e76c22c98e0c69 Mon Sep 17 00:00:00 2001 From: Sachi King Date: Wed, 6 Apr 2016 16:26:18 +1000 Subject: [PATCH] Fix soabi tests with pypy Change-Id: I9f20fad6487463ee85278d17bd79740ae337bfd7 --- pbr/tests/test_packaging.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pbr/tests/test_packaging.py b/pbr/tests/test_packaging.py index 50ff2ad5..1c8fe217 100644 --- a/pbr/tests/test_packaging.py +++ b/pbr/tests/test_packaging.py @@ -735,16 +735,17 @@ class TestRequirementParsing(base.BaseTestCase): def get_soabi(): + soabi = None try: - return sysconfig.get_config_var('SOABI') + soabi = sysconfig.get_config_var('SOABI') except IOError: pass - - if 'pypy' in sysconfig.get_scheme_names(): + if soabi is None and 'pypy' in sysconfig.get_scheme_names(): # NOTE(sigmavirus24): PyPy only added support for the SOABI config var # to sysconfig in 2015. That was well after 2.2.1 was published in the # Ubuntu 14.04 archive. for suffix, _, _ in imp.get_suffixes(): if suffix.startswith('.pypy') and suffix.endswith('.so'): - return suffix.split('.')[1] - return None + soabi = suffix.split('.')[1] + break + return soabi