From 576b5a4caf3b30d8d1baaffbd0058becf86e8591 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Thu, 18 Jun 2020 16:32:17 +0200 Subject: [PATCH] cue: fix adding Strawberry Perl to PATH --- cue-test.py | 8 +++----- cue.py | 57 +++++++++++++++++++++++++---------------------------- 2 files changed, 30 insertions(+), 35 deletions(-) diff --git a/cue-test.py b/cue-test.py index b88cc76..ccfa0d2 100644 --- a/cue-test.py +++ b/cue-test.py @@ -683,7 +683,7 @@ class TestSetupForBuild(unittest.TestCase): args = Namespace(paths=[]) cue.building_base = True if ci_os == 'windows': - sp.check_call(['choco', 'install', 'make']) + sp.check_call(['choco', 'install', 'make', 'strawberryperl']) def setUp(self): if ci_service == 'appveyor': @@ -763,12 +763,10 @@ class TestSetupForBuild(unittest.TestCase): .format(pattern[platform], os.environ['PATH'])) @unittest.skipIf(ci_os != 'windows', 'Strawberry perl test only applies to windows') - def test_StrawberryInPathVS2019(self): - if 'APPVEYOR' in os.environ: - os.environ['CMP'] = 'vs2019' + def test_StrawberryInPath(self): cue.setup_for_build(self.args) self.assertTrue(re.search('strawberry', os.environ['PATH'], flags=re.IGNORECASE), - 'Strawberry Perl installed but location not in PATH (found {0})' + 'Strawberry Perl location not in PATH (found PATH = {0})' .format(os.environ['PATH'])) def setBase314(self, yesno): diff --git a/cue.py b/cue.py index 1569e80..5f212b6 100644 --- a/cue.py +++ b/cue.py @@ -22,11 +22,10 @@ def detect_context(): ci['os'] = os.environ['TRAVIS_OS_NAME'] ci['platform'] = 'x64' ci['compiler'] = os.environ['TRAVIS_COMPILER'] - if ci['os'] == 'windows': - ci['choco'] += ['strawberryperl'] - if re.match(r'^vs', ci['compiler']): - # Only Visual Studio 2017 available - ci['compiler'] = 'vs2017' + ci['choco'] += ['strawberryperl'] + if re.match(r'^vs', ci['compiler']): + # Only Visual Studio 2017 available + ci['compiler'] = 'vs2017' if 'BCFG' in os.environ: buildconfig = os.environ['BCFG'].lower() @@ -52,8 +51,7 @@ def detect_context(): ci['platform'] = 'x64' if 'CMP' in os.environ: ci['compiler'] = os.environ['CMP'] - if ci['os'] == 'windows': - ci['choco'] += ['strawberryperl'] + ci['choco'] += ['strawberryperl'] if 'BCFG' in os.environ: buildconfig = os.environ['BCFG'].lower() @@ -566,31 +564,30 @@ def setup_for_build(args): dllpaths = [] if ci['os'] == 'windows': - if ci['service'] == 'appveyor': - if ci['compiler'] == 'vs2019': - # put strawberry perl in the PATH - os.environ['PATH'] = os.pathsep.join([os.path.join(r'C:\Strawberry\perl\site\bin'), - os.path.join(r'C:\Strawberry\perl\bin'), - os.environ['PATH']]) - if ci['compiler'] == 'gcc': - if 'INCLUDE' not in os.environ: - os.environ['INCLUDE'] = '' - if ci['platform'] == 'x86': - os.environ['INCLUDE'] = os.pathsep.join( - [r'C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\include', - os.environ['INCLUDE']]) - os.environ['PATH'] = os.pathsep.join([r'C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin', - os.environ['PATH']]) - elif ci['platform'] == 'x64': - os.environ['INCLUDE'] = os.pathsep.join( - [r'C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\include', - os.environ['INCLUDE']]) - os.environ['PATH'] = os.pathsep.join([r'C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin', - os.environ['PATH']]) - if ci['service'] == 'travis': - os.environ['PATH'] = os.pathsep.join([r'C:\Strawberry\perl\site\bin', r'C:\Strawberry\perl\bin', + if os.path.exists(r'C:\Strawberry\perl\bin'): + # Put strawberry perl in front of the PATH (so that Git Perl is further behind) + logger.debug('Adding Strawberry Perl in front of the PATH') + os.environ['PATH'] = os.pathsep.join([r'C:\Strawberry\c\bin', + r'C:\Strawberry\perl\site\bin', + r'C:\Strawberry\perl\bin', os.environ['PATH']]) + if ci['service'] == 'appveyor' and ci['compiler'] == 'gcc': + if 'INCLUDE' not in os.environ: + os.environ['INCLUDE'] = '' + if ci['platform'] == 'x86': + os.environ['INCLUDE'] = os.pathsep.join( + [r'C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\include', + os.environ['INCLUDE']]) + os.environ['PATH'] = os.pathsep.join([r'C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin', + os.environ['PATH']]) + elif ci['platform'] == 'x64': + os.environ['INCLUDE'] = os.pathsep.join( + [r'C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\include', + os.environ['INCLUDE']]) + os.environ['PATH'] = os.pathsep.join([r'C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin', + os.environ['PATH']]) + # Find BASE location if not building_base: with open(os.path.join(cachedir, 'RELEASE.local'), 'r') as f: