From 2e34d8a5ef39d6506276affe99ec019be53048d7 Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Sun, 28 Jun 2015 13:50:44 +0200 Subject: [PATCH 01/16] adaptations for Appveyor deployment (contributed by Miroslav Ilias) --- README.md | 4 ++++ appveyor.yml | 23 +++++++++++++++++++++++ update.py | 7 ++++++- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 appveyor.yml diff --git a/README.md b/README.md index 304d55e..5dc7f3b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ [![Build Status](https://travis-ci.org/scisoft/autocmake.svg?branch=master)](https://travis-ci.org/scisoft/autocmake/builds) [![Documentation Status](https://readthedocs.org/projects/autocmake/badge/?version=latest)](http://autocmake.readthedocs.org) +MiroI build statuses: +[![Build Status](https://travis-ci.org/miroi/autocmake.svg?branch=master)](https://travis-ci.org/miroi/autocmake/builds) +[![Build Status](https://ci.appveyor.com/api/projects/status/github/miroi/autocmake?branch=master&svg=true)](https://ci.appveyor.com/project/miroi/autocmake) + # Autocmake diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..23eef6d --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,23 @@ +version: 1.0.{build} +init: +- ps: >- + mkdir C:\software + + cd C:\software + + wget http://netcologne.dl.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.9.2/threads-posix/seh/x86_64-4.9.2-release-posix-seh-rt_v4-rev2.7z -OutFile MinGW.7z + + 7z x MinGW.7z > log_mingw.txt + + wget https://bootstrap.pypa.io/get-pip.py -OutFile get-pip.py + + python get-pip.py + + pip install pytest + + cd C:\projects\autocmake +environment: + path: C:\Perl\site\bin;C:\Perl\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Mercurial;C:\Program Files\7-Zip;C:\Progr am Files\Microsoft Windows Performance Toolkit\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages \v1.0\;C:\Program Files (x86)\Microsoft SDKs\Windows Azure\CLI\wbin;C:\Program Files (x86)\MSBuild\12.0\Bin;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Tools\xUnit;C:\T ools\NUnit\bin;C:\Tools\NuGet;C:\Python27;C:\Python27\Scripts;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86 )\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microso ft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Privat eAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft S QL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Tools\WebDriv er;C:\Program Files\Microsoft\Web Platform Installer\;C:\Tools\MSpec;C:\Program Files\nodejs;C:\Program Files (x86)\nodejs;C:\Program Files\Java\jdk1.7.0\bin;C:\ProgramData\chocolatey\bin;C:\Tools\GitVersion;C:\Program Files (x86 )\Microsoft Fxcop 10.0;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\CollabNet\Subversion Client;C:\Program Files (x86)\iojs;C:\Program Files\iojs;C:\Users\appveyor\AppData\Roaming\npm;C:\Pr ogram Files (x86)\Microsoft SDKs\TypeScript\1.4\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Ruby193\bin;C:\Program Files (x86)\CMake\bin;C:\go\bin;C:\Tools\Coverity\bin;C:\Program Files\erl6.3\bin;C:\Chocolatey\bin;C:\Program Files\AppVeyor\BuildAgent;C:\software\mingw64\bin +build_script: +- set PYTHONPATH=%PYTHONPATH%;%cd% +- py.test test/test.py diff --git a/update.py b/update.py index 1d0c79b..3df84bf 100755 --- a/update.py +++ b/update.py @@ -79,7 +79,8 @@ def gen_cmake_command(config): # take care of environment variables for section in config.sections(): - if config.has_option(section, 'export'): + # export on Linux - definitions placed BEFORE own cmake command + if config.has_option(section, 'export') and sys.platform != 'win32': for env in config.get(section, 'export').split('\n'): s.append(' command.append(%s)' % env) @@ -87,6 +88,10 @@ def gen_cmake_command(config): # take care of cmake definitions for section in config.sections(): + # export on Windows - definitions placed AFTER own cmake command + if config.has_option(section, 'export') and sys.platform == 'win32': + for env in config.get(section, 'export').split('\n'): + s.append(' command.append(%s)' % env) if config.has_option(section, 'define'): for definition in config.get(section, 'define').split('\n'): s.append(' command.append(%s)' % definition) From 635c4a8e6749c9fbb8bb2e80fd9e90a25d12a3ea Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Sun, 28 Jun 2015 14:06:46 +0200 Subject: [PATCH 02/16] i don't think this is correct --- update.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/update.py b/update.py index 3df84bf..5a29c5e 100755 --- a/update.py +++ b/update.py @@ -88,10 +88,6 @@ def gen_cmake_command(config): # take care of cmake definitions for section in config.sections(): - # export on Windows - definitions placed AFTER own cmake command - if config.has_option(section, 'export') and sys.platform == 'win32': - for env in config.get(section, 'export').split('\n'): - s.append(' command.append(%s)' % env) if config.has_option(section, 'define'): for definition in config.get(section, 'define').split('\n'): s.append(' command.append(%s)' % definition) From 5398c2a9c266f59db902a9f4c6cd232f2090c072 Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Sun, 28 Jun 2015 14:39:15 +0200 Subject: [PATCH 03/16] hopefully fix env variables on win32 --- update.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/update.py b/update.py index 5a29c5e..ba57bd7 100755 --- a/update.py +++ b/update.py @@ -79,10 +79,20 @@ def gen_cmake_command(config): # take care of environment variables for section in config.sections(): - # export on Linux - definitions placed BEFORE own cmake command - if config.has_option(section, 'export') and sys.platform != 'win32': + if config.has_option(section, 'export'): for env in config.get(section, 'export').split('\n'): - s.append(' command.append(%s)' % env) + if sys.platform == 'win32': + # on windows we have to replace: + # CC=gcc CXX=g++ cmake [definitions] .. + # by: + # set CC=gcc && set CXX=g++ && cmake [definitions] .. + p1 = re.compile('\'(?=\w.*\=)') + env1 = p1.sub('\'set ', env) + p2 = re.compile('\'(?=\s)') + env2 = p2.sub(' &&\'', env1) + else: + env2 = env + s.append(' command.append(%s)' % env2) s.append(" command.append('cmake')") From e59a0424900abe9d7513acb16147e9ac267be9b7 Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Sun, 28 Jun 2015 14:41:15 +0200 Subject: [PATCH 04/16] annotation for the regexing --- update.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/update.py b/update.py index ba57bd7..1ec69d7 100755 --- a/update.py +++ b/update.py @@ -86,10 +86,10 @@ def gen_cmake_command(config): # CC=gcc CXX=g++ cmake [definitions] .. # by: # set CC=gcc && set CXX=g++ && cmake [definitions] .. - p1 = re.compile('\'(?=\w.*\=)') - env1 = p1.sub('\'set ', env) - p2 = re.compile('\'(?=\s)') - env2 = p2.sub(' &&\'', env1) + p1 = re.compile('\'(?=\w.*\=)') # match first "'" in 'FOO=BAR' + env1 = p1.sub('\'set ', env) # change to 'set FOO=BAR' + p2 = re.compile('\'(?=\s)') # match second "'" in 'FOO=BAR' + env2 = p2.sub(' &&\'', env1) # change to 'set FOO=BAR &&' else: env2 = env s.append(' command.append(%s)' % env2) From 36ab8c14a785698711862e7736283f694e61a0ba Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Sun, 28 Jun 2015 15:30:23 +0200 Subject: [PATCH 05/16] comment --- update.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/update.py b/update.py index 1ec69d7..52fd6e6 100755 --- a/update.py +++ b/update.py @@ -81,6 +81,8 @@ def gen_cmake_command(config): for section in config.sections(): if config.has_option(section, 'export'): for env in config.get(section, 'export').split('\n'): + # FIXME there may be no win32 check in this file + # win32 platform dependency has to be dealt with in setup.py if sys.platform == 'win32': # on windows we have to replace: # CC=gcc CXX=g++ cmake [definitions] .. From 7d3f2c1527535b7ab32b2ab08df415f43beff6d0 Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Sun, 28 Jun 2015 19:36:33 +0200 Subject: [PATCH 06/16] remove win32 dependency in update.py the command line rewrite needs to happen in setup.py (ideally by a function defined in config.py) otherwise setup.py becomes hardcoded to a platform and we want it portable --- update.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/update.py b/update.py index 52fd6e6..1d0c79b 100755 --- a/update.py +++ b/update.py @@ -81,20 +81,7 @@ def gen_cmake_command(config): for section in config.sections(): if config.has_option(section, 'export'): for env in config.get(section, 'export').split('\n'): - # FIXME there may be no win32 check in this file - # win32 platform dependency has to be dealt with in setup.py - if sys.platform == 'win32': - # on windows we have to replace: - # CC=gcc CXX=g++ cmake [definitions] .. - # by: - # set CC=gcc && set CXX=g++ && cmake [definitions] .. - p1 = re.compile('\'(?=\w.*\=)') # match first "'" in 'FOO=BAR' - env1 = p1.sub('\'set ', env) # change to 'set FOO=BAR' - p2 = re.compile('\'(?=\s)') # match second "'" in 'FOO=BAR' - env2 = p2.sub(' &&\'', env1) # change to 'set FOO=BAR &&' - else: - env2 = env - s.append(' command.append(%s)' % env2) + s.append(' command.append(%s)' % env) s.append(" command.append('cmake')") From f20799e3e2081ac6618fc43969010e8986f6a4be Mon Sep 17 00:00:00 2001 From: Miro ILIAS Date: Sun, 28 Jun 2015 22:14:12 +0200 Subject: [PATCH 07/16] inserted function for preprocesing cmake_command for MS Windows,testing phase --- lib/config.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/lib/config.py b/lib/config.py index a2e416b..495dfd4 100644 --- a/lib/config.py +++ b/lib/config.py @@ -43,6 +43,38 @@ def setup_build_path(build_path): else: os.makedirs(build_path, 0o755) +def adapt_cmake_command_to_arch(cmake_command): + """ + Adapt CMake command for MS Windows architecture: + + "FC=foo CC=bar cmake -DTHIS -DTHAT='this and that'" rewrites into + + "set FC=foo && set CC=bar && cmake -DTHIS -DTHAT='this and that'" + """ + + if sys.platform == 'win32': + cmake_pos=cmake_command.find('cmake') + cmake_export_vars=cmake_command[:cmake_pos] + cmake_strings=cmake_command[cmake_pos:] + print "\n strings from cmake to right:",cmake_strings + print "strings from left up to cmake:",cmake_export_vars + print "strings from left up to cmake, split:",cmake_export_vars.split() + all_modified_exported_vars="" + for exported_var in cmake_export_vars.split(): + print "exported_var=",exported_var + modified_exported_var="set " + exported_var + " && " + all_modified_exported_vars=all_modified_exported_vars+modified_exported_var + print "all_modified_exported_vars=",all_modified_exported_vars + cmake_command_win=all_modified_exported_vars+cmake_strings + print "cmake_command_win=",cmake_command_win + print "\n" + #sys.exit(-1) + cmake_command_arch = cmake_command_win + else: + cmake_command_arch = cmake_command + + return cmake_command_arch + def run_cmake(command, build_path, default_build_path): """ @@ -115,6 +147,8 @@ def configure(root_directory, build_path, cmake_command, only_show): if not only_show: setup_build_path(build_path) + cmake_command=adapt_cmake_command_to_arch(cmake_command) + print('%s\n' % cmake_command) if only_show: sys.exit(0) From a2924b9f69134011a4efdcbe9bd9477c9be244fd Mon Sep 17 00:00:00 2001 From: Miro ILIAS Date: Sun, 28 Jun 2015 22:18:55 +0200 Subject: [PATCH 08/16] cmake_command preprocessing function adapted/polished for MS Window --- lib/config.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/config.py b/lib/config.py index 495dfd4..8308621 100644 --- a/lib/config.py +++ b/lib/config.py @@ -47,29 +47,20 @@ def adapt_cmake_command_to_arch(cmake_command): """ Adapt CMake command for MS Windows architecture: - "FC=foo CC=bar cmake -DTHIS -DTHAT='this and that'" rewrites into + "FC=foo CC=bar cmake -DTHIS -DTHAT='this and that'" rewrites into - "set FC=foo && set CC=bar && cmake -DTHIS -DTHAT='this and that'" + "set FC=foo && set CC=bar && cmake -DTHIS -DTHAT='this and that'" """ if sys.platform == 'win32': cmake_pos=cmake_command.find('cmake') cmake_export_vars=cmake_command[:cmake_pos] cmake_strings=cmake_command[cmake_pos:] - print "\n strings from cmake to right:",cmake_strings - print "strings from left up to cmake:",cmake_export_vars - print "strings from left up to cmake, split:",cmake_export_vars.split() all_modified_exported_vars="" for exported_var in cmake_export_vars.split(): - print "exported_var=",exported_var modified_exported_var="set " + exported_var + " && " all_modified_exported_vars=all_modified_exported_vars+modified_exported_var - print "all_modified_exported_vars=",all_modified_exported_vars - cmake_command_win=all_modified_exported_vars+cmake_strings - print "cmake_command_win=",cmake_command_win - print "\n" - #sys.exit(-1) - cmake_command_arch = cmake_command_win + cmake_command_arch = all_modified_exported_vars + cmake_strings else: cmake_command_arch = cmake_command From 196470a0ff60631d32536cdc7e26e1c0bd565262 Mon Sep 17 00:00:00 2001 From: Miro ILIAS Date: Sun, 28 Jun 2015 22:26:07 +0200 Subject: [PATCH 09/16] added badge for appveyor-CI using scisoft/autocmake branch appveyor --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 5dc7f3b..29c3540 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,6 @@ [![Build Status](https://travis-ci.org/scisoft/autocmake.svg?branch=master)](https://travis-ci.org/scisoft/autocmake/builds) [![Documentation Status](https://readthedocs.org/projects/autocmake/badge/?version=latest)](http://autocmake.readthedocs.org) - -MiroI build statuses: -[![Build Status](https://travis-ci.org/miroi/autocmake.svg?branch=master)](https://travis-ci.org/miroi/autocmake/builds) -[![Build Status](https://ci.appveyor.com/api/projects/status/github/miroi/autocmake?branch=master&svg=true)](https://ci.appveyor.com/project/miroi/autocmake) +[![Build Status](https://ci.appveyor.com/api/projects/status/github/scisoft/autocmake?branch=appveyor&svg=true)](https://ci.appveyor.com/project/scisoft/autocmake) # Autocmake From 46cf853445f0bab528f3bd02903202a91df8e4b0 Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Mon, 29 Jun 2015 22:01:13 +0200 Subject: [PATCH 10/16] pep8 fixes --- lib/config.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/config.py b/lib/config.py index 9a8ca70..09e7d1e 100644 --- a/lib/config.py +++ b/lib/config.py @@ -43,6 +43,7 @@ def setup_build_path(build_path): else: os.makedirs(build_path, 0o755) + def adapt_cmake_command_to_arch(cmake_command): """ Adapt CMake command for MS Windows architecture: @@ -53,13 +54,13 @@ def adapt_cmake_command_to_arch(cmake_command): """ if sys.platform == 'win32': - cmake_pos=cmake_command.find('cmake') - cmake_export_vars=cmake_command[:cmake_pos] - cmake_strings=cmake_command[cmake_pos:] - all_modified_exported_vars="" + cmake_pos = cmake_command.find('cmake') + cmake_export_vars = cmake_command[:cmake_pos] + cmake_strings = cmake_command[cmake_pos:] + all_modified_exported_vars = "" for exported_var in cmake_export_vars.split(): - modified_exported_var="set " + exported_var + " && " - all_modified_exported_vars=all_modified_exported_vars+modified_exported_var + modified_exported_var = "set " + exported_var + " && " + all_modified_exported_vars = all_modified_exported_vars + modified_exported_var cmake_command_arch = all_modified_exported_vars + cmake_strings else: cmake_command_arch = cmake_command @@ -136,7 +137,7 @@ def configure(root_directory, build_path, cmake_command, only_show): if not only_show: setup_build_path(build_path) - cmake_command=adapt_cmake_command_to_arch(cmake_command) + cmake_command = adapt_cmake_command_to_arch(cmake_command) print('%s\n' % cmake_command) if only_show: From a8d412eae4052e25bc00f6b303066a72b2517f90 Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Mon, 29 Jun 2015 22:02:10 +0200 Subject: [PATCH 11/16] pass sys.platform - this way we can test win32 also on linux --- lib/config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/config.py b/lib/config.py index 09e7d1e..d0f5391 100644 --- a/lib/config.py +++ b/lib/config.py @@ -44,7 +44,7 @@ def setup_build_path(build_path): os.makedirs(build_path, 0o755) -def adapt_cmake_command_to_arch(cmake_command): +def adapt_cmake_command_to_arch(cmake_command, platform): """ Adapt CMake command for MS Windows architecture: @@ -53,7 +53,7 @@ def adapt_cmake_command_to_arch(cmake_command): "set FC=foo && set CC=bar && cmake -DTHIS -DTHAT='this and that'" """ - if sys.platform == 'win32': + if platform == 'win32': cmake_pos = cmake_command.find('cmake') cmake_export_vars = cmake_command[:cmake_pos] cmake_strings = cmake_command[cmake_pos:] @@ -137,7 +137,7 @@ def configure(root_directory, build_path, cmake_command, only_show): if not only_show: setup_build_path(build_path) - cmake_command = adapt_cmake_command_to_arch(cmake_command) + cmake_command = adapt_cmake_command_to_arch(cmake_command, sys.platform) print('%s\n' % cmake_command) if only_show: From e3b8f29e2109809c24de227acb75e30599c09091 Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Mon, 29 Jun 2015 22:09:36 +0200 Subject: [PATCH 12/16] unit test for test_adapt_cmake_command_to_platform --- .travis.yml | 1 + lib/config.py | 31 +++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index a1526e7..a10d796 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,3 +7,4 @@ script: - pep8 --ignore=E501 test/test.py - pep8 --ignore=E501 lib/config.py - py.test -vv test/test.py + - py.test -vv lib/config.py diff --git a/lib/config.py b/lib/config.py index d0f5391..4a02b73 100644 --- a/lib/config.py +++ b/lib/config.py @@ -44,13 +44,24 @@ def setup_build_path(build_path): os.makedirs(build_path, 0o755) -def adapt_cmake_command_to_arch(cmake_command, platform): +def test_adapt_cmake_command_to_platform(): + + cmake_command = "FC=foo CC=bar CXX=RABOOF cmake -DTHIS -DTHAT='this and that cmake' .." + res = adapt_cmake_command_to_platform(cmake_command, 'linux') + assert res == cmake_command + res = adapt_cmake_command_to_platform(cmake_command, 'win32') + assert res == "set FC=foo && set CC=bar && set CXX=RABOOF && cmake -DTHIS -DTHAT='this and that cmake' .." + + cmake_command = "cmake -DTHIS -DTHAT='this and that cmake' .." + res = adapt_cmake_command_to_platform(cmake_command, 'linux') + assert res == cmake_command + res = adapt_cmake_command_to_platform(cmake_command, 'win32') + assert res == cmake_command + + +def adapt_cmake_command_to_platform(cmake_command, platform): """ - Adapt CMake command for MS Windows architecture: - - "FC=foo CC=bar cmake -DTHIS -DTHAT='this and that'" rewrites into - - "set FC=foo && set CC=bar && cmake -DTHIS -DTHAT='this and that'" + Adapts CMake command to MS Windows platform. """ if platform == 'win32': @@ -61,11 +72,11 @@ def adapt_cmake_command_to_arch(cmake_command, platform): for exported_var in cmake_export_vars.split(): modified_exported_var = "set " + exported_var + " && " all_modified_exported_vars = all_modified_exported_vars + modified_exported_var - cmake_command_arch = all_modified_exported_vars + cmake_strings + cmake_command_platform = all_modified_exported_vars + cmake_strings else: - cmake_command_arch = cmake_command + cmake_command_platform = cmake_command - return cmake_command_arch + return cmake_command_platform def run_cmake(command, build_path, default_build_path): @@ -137,7 +148,7 @@ def configure(root_directory, build_path, cmake_command, only_show): if not only_show: setup_build_path(build_path) - cmake_command = adapt_cmake_command_to_arch(cmake_command, sys.platform) + cmake_command = adapt_cmake_command_to_platform(cmake_command, sys.platform) print('%s\n' % cmake_command) if only_show: From e09b663c0e7d6b7a8a46986c3183e5c4e280ec1f Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Mon, 29 Jun 2015 22:21:19 +0200 Subject: [PATCH 13/16] refactor --- lib/config.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/config.py b/lib/config.py index 4a02b73..5ce6086 100644 --- a/lib/config.py +++ b/lib/config.py @@ -65,18 +65,14 @@ def adapt_cmake_command_to_platform(cmake_command, platform): """ if platform == 'win32': - cmake_pos = cmake_command.find('cmake') - cmake_export_vars = cmake_command[:cmake_pos] - cmake_strings = cmake_command[cmake_pos:] - all_modified_exported_vars = "" - for exported_var in cmake_export_vars.split(): - modified_exported_var = "set " + exported_var + " && " - all_modified_exported_vars = all_modified_exported_vars + modified_exported_var - cmake_command_platform = all_modified_exported_vars + cmake_strings + pos = cmake_command.find('cmake') + cmake_export_vars = cmake_command[:pos] + rest = cmake_command[pos:] + s = ['set %s &&' % e for e in cmake_export_vars.split()] + s.append(rest) + return ' '.join(s) else: - cmake_command_platform = cmake_command - - return cmake_command_platform + return cmake_command def run_cmake(command, build_path, default_build_path): From 0f5feb9c36cca5735b8ebde516f843d0bfcc6eaa Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Mon, 29 Jun 2015 22:23:07 +0200 Subject: [PATCH 14/16] further refactor --- lib/config.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/config.py b/lib/config.py index 5ce6086..be34c43 100644 --- a/lib/config.py +++ b/lib/config.py @@ -61,15 +61,12 @@ def test_adapt_cmake_command_to_platform(): def adapt_cmake_command_to_platform(cmake_command, platform): """ - Adapts CMake command to MS Windows platform. + Adapt CMake command to MS Windows platform. """ - if platform == 'win32': pos = cmake_command.find('cmake') - cmake_export_vars = cmake_command[:pos] - rest = cmake_command[pos:] - s = ['set %s &&' % e for e in cmake_export_vars.split()] - s.append(rest) + s = ['set %s &&' % e for e in cmake_command[:pos].split()] + s.append(cmake_command[pos:]) return ' '.join(s) else: return cmake_command From 249bd8675755b6a479e777e0de1ababb3ba42b5e Mon Sep 17 00:00:00 2001 From: IvanHrasko Date: Sun, 5 Jul 2015 22:35:59 +0200 Subject: [PATCH 15/16] ihrasko: improved test script for appveyor using shorter path testing both 32-bit and 64-bit Python versions downloading and using the latest 5.1.0 version of mingw-w64 compilers --- appveyor.yml | 75 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 56 insertions(+), 19 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 23eef6d..ae67fcc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,23 +1,60 @@ +## +# The autocmake project test configuration for Windows OS at AppVeyor +# +# Current software used: +# OS: 64-bit Windows Server 2012 R2 +# Compilers: 64-bit MinGw-w64 5.1.0 (downloaded during script execution) +# Python: 2.7, both 32-bit and 64-bit versions +# +# Notes: +# Can be extended for use with Python 3 +# Where "ps:" is used commands are executed in PowerShell +## + +# build version format: 1.0.1, 1.0.2, ... version: 1.0.{build} -init: -- ps: >- - mkdir C:\software - cd C:\software - - wget http://netcologne.dl.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.9.2/threads-posix/seh/x86_64-4.9.2-release-posix-seh-rt_v4-rev2.7z -OutFile MinGW.7z - - 7z x MinGW.7z > log_mingw.txt - - wget https://bootstrap.pypa.io/get-pip.py -OutFile get-pip.py - - python get-pip.py - - pip install pytest - - cd C:\projects\autocmake +# prepare environment environment: - path: C:\Perl\site\bin;C:\Perl\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Mercurial;C:\Program Files\7-Zip;C:\Progr am Files\Microsoft Windows Performance Toolkit\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages \v1.0\;C:\Program Files (x86)\Microsoft SDKs\Windows Azure\CLI\wbin;C:\Program Files (x86)\MSBuild\12.0\Bin;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Tools\xUnit;C:\T ools\NUnit\bin;C:\Tools\NuGet;C:\Python27;C:\Python27\Scripts;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86 )\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microso ft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Privat eAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft S QL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Tools\WebDriv er;C:\Program Files\Microsoft\Web Platform Installer\;C:\Tools\MSpec;C:\Program Files\nodejs;C:\Program Files (x86)\nodejs;C:\Program Files\Java\jdk1.7.0\bin;C:\ProgramData\chocolatey\bin;C:\Tools\GitVersion;C:\Program Files (x86 )\Microsoft Fxcop 10.0;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\CollabNet\Subversion Client;C:\Program Files (x86)\iojs;C:\Program Files\iojs;C:\Users\appveyor\AppData\Roaming\npm;C:\Pr ogram Files (x86)\Microsoft SDKs\TypeScript\1.4\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Ruby193\bin;C:\Program Files (x86)\CMake\bin;C:\go\bin;C:\Tools\Coverity\bin;C:\Program Files\erl6.3\bin;C:\Chocolatey\bin;C:\Program Files\AppVeyor\BuildAgent;C:\software\mingw64\bin +# set custom path (will be more extended later in build_script section) + path: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Git\cmd;C:\Program Files\7-Zip;C:\Program Files (x86)\CMake\bin +# set MinGw-w64 (64-bit) version 5.1.0 download URL + url: http://kent.dl.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/5.1.0/threads-posix/seh/x86_64-5.1.0-release-posix-seh-rt_v4-rev0.7z +# user can possibly use different Python versions, we try to test multiple cases +# 64-bit version is recommended + matrix: +# Python 2.7; 32-bit version + - python: C:\Python27;C:\Python27\Scripts +# Python 2.7; 64-bit version + - python: C:\Python27-x64;C:\Python27-x64\Scripts + build_script: -- set PYTHONPATH=%PYTHONPATH%;%cd% -- py.test test/test.py +# add location of used Python to path +- set path=%path%;%python% + +# create dir for custom software and move there +- mkdir C:\software && cd C:\software + +# download and unpack MinGw-w64 compilers +- ps: wget $env:url -OutFile MinGW.7z +- 7z x MinGW.7z > NUL + +# add compilers binary dir to path +- set path=%path%;C:\software\mingw64\bin + +# download and upgrade pip +- ps: wget https://bootstrap.pypa.io/get-pip.py -OutFile get-pip.py +- python get-pip.py + +# install py.test +- pip install pytest + +# go back to project source dir +- cd C:\projects\autocmake + +test_script: +# show environment +- echo %path% +- py.test --version +# run tests +- py.test -v test/test.py From 2b76a1d148b60314abf3fc184cca5033d02f60c5 Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Mon, 6 Jul 2015 16:17:54 +0200 Subject: [PATCH 16/16] rm trailing blanks --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index ae67fcc..9c28186 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,6 @@ ## # The autocmake project test configuration for Windows OS at AppVeyor -# +# # Current software used: # OS: 64-bit Windows Server 2012 R2 # Compilers: 64-bit MinGw-w64 5.1.0 (downloaded during script execution)