Skip to content

Commit

Permalink
parse gcc version 10 (#6551)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgsogo authored Feb 17, 2020
1 parent 2ec0aa1 commit 7c94316
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion conans/client/conf/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _gcc_compiler(output, compiler_exe="gcc"):
if ret != 0:
return None
compiler = "gcc"
installed_version = re.search("([0-9](\.[0-9])?)", out).group()
installed_version = re.search("([0-9]+(\.[0-9])?)", out).group()
# Since GCC 7.1, -dumpversion return the major version number
# only ("7"). We must use -dumpfullversion to get the full version
# number ("7.1.1").
Expand Down
19 changes: 19 additions & 0 deletions conans/test/unittests/client/conf/detect/test_gcc_compiler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import unittest

import mock
from parameterized import parameterized

from conans.client.conf.detect import _gcc_compiler
from conans.test.utils.tools import TestBufferConanOutput


class GCCCompilerTestCase(unittest.TestCase):

@parameterized.expand([("10",), ("4.2",), ('7', )])
def test_detect_gcc_10(self, version):
output = TestBufferConanOutput()
with mock.patch("platform.system", return_value="Linux"):
with mock.patch("conans.client.conf.detect.detect_runner", return_value=(0, version)):
compiler, installed_version = _gcc_compiler(output)
self.assertEqual(compiler, 'gcc')
self.assertEqual(installed_version, version)

0 comments on commit 7c94316

Please sign in to comment.