diff --git a/.cmake/cram-env.patch b/.cmake/cram-env.patch new file mode 100644 index 0000000..6103a15 --- /dev/null +++ b/.cmake/cram-env.patch @@ -0,0 +1,18 @@ +--- _test.py.orig 2016-09-03 00:50:27.505527300 +0200 ++++ "/c/Program Files/Python35/lib/site-packages/cram/_test.py" 2016-09-03 00:48:48.708932100 +0200 +@@ -143,11 +143,15 @@ + after.setdefault(pos, []).append(line) + stdin.append(b('echo %s %s $?\n' % (usalt, i + 1))) + ++ env = {k: v.decode('utf-8') if isinstance(v, bytes) else v for k, v in env.items()} ++ + output, retcode = execute(shell + ['-'], stdin=b('').join(stdin), + stdout=PIPE, stderr=STDOUT, env=env) + if retcode == 80: + return (refout, None, []) + ++ output = output.replace(b'\r\n', b'\n').replace(b'\r', b'\n') ++ + pos = -1 + ret = 0 + for i, line in enumerate(output[:-1].splitlines(True)): diff --git a/.cmake/cram-win.patch b/.cmake/cram-win.patch deleted file mode 100644 index cf73c04..0000000 --- a/.cmake/cram-win.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- /usr/lib/python3.5/site-packages/cram.py 2016-01-16 20:22:50.188589086 +0100 -+++ cram.py 2016-01-20 12:02:14.881815552 +0100 -@@ -12,6 +12,9 @@ - import shutil - import time - import tempfile -+import re -+ -+_newlines_re = re.compile(r'(\r\n|\r|\r)') - - try: - import configparser -@@ -168,14 +171,14 @@ - cmdline = '%s$ ' % indent - conline = '%s> ' % indent - -- f = open(path) -+ f = open(path, 'r', encoding='utf-8') - abspath = os.path.abspath(path) - env = os.environ.copy() - env['TESTDIR'] = os.path.dirname(abspath) - env['TESTFILE'] = os.path.basename(abspath) - p = subprocess.Popen([shell, '-'], bufsize=-1, stdin=subprocess.PIPE, - stdout=subprocess.PIPE, stderr=subprocess.STDOUT, -- universal_newlines=True, env=env, -+ universal_newlines=False, env=env, - preexec_fn=makeresetsigpipe(), - close_fds=os.name == 'posix') - salt = 'CRAM%s' % time.time() -@@ -199,7 +202,8 @@ - after.setdefault(pos, []).append(line) - stdin.append('echo "\n%s %s $?"\n' % (salt, i + 1)) - -- output = p.communicate(input=''.join(stdin))[0] -+ output = p.communicate(input=''.join(stdin).encode('utf-8'))[0].decode('utf-8') -+ output = _newlines_re.sub('\n', output) - if p.returncode == 80: - return (refout, None, []) - -@@ -336,7 +340,7 @@ - log('!', 'failed\n', verbose) - if not quiet: - log('\n', None, verbose) -- errfile = open(errpath, 'w') -+ errfile = open(errpath, 'w', encoding='utf-8') - try: - for line in postout: - errfile.write(line) diff --git a/appveyor.yml b/appveyor.yml index 4b2d6c3..457c9c1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,60 +2,57 @@ version: 2.2.2_b{build}-{branch} os: Visual Studio 2015 -init: - - git config --global core.autocrlf input - - set "PATH=C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH%" - - set MSYSTEM=MINGW64 - - pacman --noconfirm --needed -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake - - set "PATH=%PATH%;%APPVEYOR_BUILD_FOLDER%\build;%APPVEYOR_BUILD_FOLDER%\build\Debug;%APPVEYOR_BUILD_FOLDER%\build\external\bin;%APPVEYOR_BUILD_FOLDER%\build\external\lib" - environment: COVERALLS_REPO_TOKEN: secure: 5nuCg+faxFPeppoNNcSwVobswAVFUf8ut83vw8CX/4W2y0kZkGmwEfCUxSQWiQDU CI_NAME: appveyor CI_JOB_ID: $(APPVEYOR_JOB_ID) GCOV_PREFIX: $(APPVEYOR_BUILD_FOLDER) - PYTHON: "C:\\Python34" - PYTHON_BIN: "C:\\Python34\\python.exe" - PYTHON_VERSION: "3.4.2" - PYTHON_ARCH: "32" + PYTHON_BIN: python PYTHONIOENCODING: "utf-8" # consider cmd encoding to be unicode CRAM_SHELL: "C:\\msys64\\usr\\bin\\sh.exe" matrix: - COMPILER: mingw GENERATOR: "MSYS Makefiles" - CXXFLAGS: -D__NO_INLINE__ + BUILD_FLAGS: -j2 - COMPILER: msvc - GENERATOR: "Visual Studio 14 2015" + GENERATOR: "Visual Studio 14 2015 Win64" CFLAGS: /MP CXXFLAGS: /MP + BUILD_FLAGS: /verbosity:m + +init: + - git config --global core.autocrlf input + - set MSYSTEM=MINGW64 + + # Disable windows process crash popup + # See: https://msdn.microsoft.com/en-us/library/bb513638%28VS.85%29.aspx + - reg add "HKLM\SYSTEM\CurrentControlSet\Control\Windows" /f /v ErrorMode /t REG_DWORD /d 2 + - reg add "HKLM\Software\Microsoft\Windows\Windows Error Reporting" /f /v DontShowUI /t REG_DWORD /d 1 + - reg add "HKLM\Software\Microsoft\Windows\Windows Error Reporting" /f /v Disable /t REG_DWORD /d 1 + + - set PATH=C:\Python35;C:\Python35\Scripts;C:\msys64\mingw32\bin;C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH% + - set PATH=%PATH%;%APPVEYOR_BUILD_FOLDER%\build;%APPVEYOR_BUILD_FOLDER%\build\Debug;%APPVEYOR_BUILD_FOLDER%\build\external\bin;%APPVEYOR_BUILD_FOLDER%\build\external\lib" + - set MSYSTEM=MINGW64 + - pip install cram==0.7 + + # Remove Xamarin msbuild warnings + - del "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets" clone_depth: 5 -platform: - - x86 - - x64 - configuration: - Debug - RelWithDebInfo install: - # Install Python - - ps: if (-not(Test-Path($env:PYTHON))) { & .cmake\install_python.ps1 } - - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PYTHON%\\bin;%PATH%" - - python --version - # Upgrade pip - - "pip install --disable-pip-version-check --user --upgrade pip" - # Install cram - - "pip install cram==0.6" - - python -m cram --version - # Patch buggy cram - - sh -c "patch C:/Python34/Lib/site-packages/cram.py .cmake/cram-win.patch" - - ps: $env:RELEASE_NAME = $env:APPVEYOR_REPO_BRANCH -replace "/", "-" # Hack to make git think it is on the tip of the repo branch - 'git checkout -B %APPVEYOR_REPO_BRANCH%' + + # Patch buggy cram + - sh -c "patch /c/Python35/lib/site-packages/cram/_test.py .cmake/cram-env.patch" + # Configure project - 'mkdir build && cd build' - > @@ -70,8 +67,8 @@ install: .. build_script: - # open dummy fd 0 to prevent errors at configure time for nanomsg - - cmake --build . 0