diff options
-rw-r--r-- | QMTest/TestCmd.py | 31 | ||||
-rw-r--r-- | src/CHANGES.txt | 4 | ||||
-rw-r--r-- | src/engine/SCons/ActionTests.py | 5 | ||||
-rw-r--r-- | src/engine/SCons/Tool/MSCommon/vc.py | 8 | ||||
-rw-r--r-- | src/engine/SCons/Tool/MSCommon/vs.py | 92 | ||||
-rw-r--r-- | src/engine/SCons/Tool/msvc.xml | 22 | ||||
-rw-r--r-- | src/engine/SCons/Tool/msvsTests.py | 13 | ||||
-rw-r--r-- | testing/README.md | 7 | ||||
-rw-r--r-- | testing/buildbot.hosts | 1 | ||||
-rw-r--r-- | testing/buildbot.yml | 80 |
10 files changed, 195 insertions, 68 deletions
diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py index 38e9cd3..b51d90f 100644 --- a/QMTest/TestCmd.py +++ b/QMTest/TestCmd.py @@ -672,8 +672,35 @@ except AttributeError: PIPE = subprocess.PIPE if subprocess.mswindows: - from win32file import ReadFile, WriteFile - from win32pipe import PeekNamedPipe + try: + from win32file import ReadFile, WriteFile + from win32pipe import PeekNamedPipe + except ImportError: + # If PyWin32 is not available, try ctypes instead + # XXX These replicate _just_enough_ PyWin32 behaviour for our purposes + import ctypes; from ctypes.wintypes import DWORD + def ReadFile(hFile, bufSize, ol=None): + assert ol is None + lpBuffer = ctypes.create_string_buffer(bufSize) + bytesRead = DWORD() + bErr = ctypes.windll.kernel32.ReadFile( + hFile, lpBuffer, bufSize, ctypes.byref(bytesRead), ol) + if not bErr: raise ctypes.WinError() + return (0, ctypes.string_at(lpBuffer, bytesRead.value)) + def WriteFile(hFile, data, ol=None): + assert ol is None + bytesWritten = DWORD() + bErr = ctypes.windll.kernel32.WriteFile( + hFile, data, len(data), ctypes.byref(bytesWritten), ol) + if not bErr: raise ctypes.WinError() + return (0, bytesWritten.value) + def PeekNamedPipe(hPipe, size): + assert size == 0 + bytesAvail = DWORD() + bErr = ctypes.windll.kernel32.PeekNamedPipe( + hPipe, None, size, None, ctypes.byref(bytesAvail), None) + if not bErr: raise ctypes.WinError() + return ("", bytesAvail.value, None) import msvcrt else: import select diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 57b961c..ea2bb0c 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,10 @@ RELEASE 2.3.2.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + From Sye van der Veen: + - Support for Visual Studio 12.0Exp, and fixes for earlier MSVS + versions. + From Anatoly Techtonik: - Several improvements for running scons.py from source: * engine files form source directory take priority over all other diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py index 13c3b6c..3e900d7 100644 --- a/src/engine/SCons/ActionTests.py +++ b/src/engine/SCons/ActionTests.py @@ -185,9 +185,8 @@ class DummyNode(object): if os.name == 'java': python = os.path.join(sys.prefix, 'jython') else: - python = sys.executable - -_python_ = '"' + python + '"' + python = os.environ.get('python_executable', sys.executable) +_python_ = test.escape(python) _null = SCons.Action._null diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index c970118..6a801ad 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -89,6 +89,7 @@ _ARCH_TO_CANONICAL = { _HOST_TARGET_ARCH_TO_BAT_ARCH = { ("x86", "x86"): "x86", ("x86", "amd64"): "x86_amd64", + ("x86", "x86_amd64"): "x86_amd64", ("amd64", "x86_amd64"): "x86_amd64", # This is present in (at least) VS2012 express ("amd64", "amd64"): "amd64", ("amd64", "x86"): "x86", @@ -131,9 +132,14 @@ def get_host_target(env): return (host, target,req_target_platform) -_VCVER = ["11.0", "11.0Exp", "10.0", "10.0Exp", "9.0", "9.0Exp","8.0", "8.0Exp","7.1", "7.0", "6.0"] +# If you update this, update SupportedVSList in Tool/MSCommon/vs.py, and the +# MSVC_VERSION documentation in Tool/msvc.xml. +# TODO Visual C 12.0 +_VCVER = ["12.0Exp", "11.0", "11.0Exp", "10.0", "10.0Exp", "9.0", "9.0Exp","8.0", "8.0Exp","7.1", "7.0", "6.0"] _VCVER_TO_PRODUCT_DIR = { + '12.0Exp' : [ + r'Microsoft\VCExpress\12.0\Setup\VC\ProductDir'], '11.0': [ r'Microsoft\VisualStudio\11.0\Setup\VC\ProductDir'], '11.0Exp' : [ diff --git a/src/engine/SCons/Tool/MSCommon/vs.py b/src/engine/SCons/Tool/MSCommon/vs.py index d5bf2c3..88da98a 100644 --- a/src/engine/SCons/Tool/MSCommon/vs.py +++ b/src/engine/SCons/Tool/MSCommon/vs.py @@ -73,7 +73,7 @@ class VisualStudio(object): debug('find_vs_dir(): no installed VC %s' % self.vc_version) return None return dir - + def find_vs_dir_by_reg(self): root = 'Software\\' @@ -91,13 +91,13 @@ class VisualStudio(object): debug('find_vs_dir_by_reg(): found VS in registry: %s' % comps) return comps return None - + def find_vs_dir(self): """ Can use registry or location of VC to find vs dir First try to find by registry, and if that fails find via VC dir """ - - + + if True: vs_dir=self.find_vs_dir_by_reg() return vs_dir @@ -115,7 +115,7 @@ class VisualStudio(object): debug('find_executable(): %s not on file system' % executable) return None return executable - + # def get_batch_file(self): @@ -199,102 +199,87 @@ class VisualStudio(object): # good money for in preference to whatever Microsoft makes available # for free. # -# If you update this list, update the documentation in Tool/msvs.xml. +# If you update this list, update _VCVER and _VCVER_TO_PRODUCT_DIR in +# Tool/MSCommon/vc.py, and the MSVC_VERSION documentation in Tool/msvc.xml. SupportedVSList = [ - # Visual Studio 2010 - # TODO: find the settings, perhaps from someone with a CTP copy? - #VisualStudio('TBD', - # hkey_root=r'TBD', - # common_tools_var='TBD', - # executable_path=r'TBD', - # default_dirname='TBD', - #), - - # Visual Studio 11 - # The batch file we look for is in the VC directory, - # so the devenv.com executable is up in ..\..\Common7\IDE. + # TODO Visual Studio 2013 + + # Visual C++ 2013 Express Edition (for Desktop) + VisualStudio('12.0Exp', + vc_version='12.0', + sdk_version='8.1A', + hkeys=[r'Microsoft\VisualStudio\12.0\Setup\VS\ProductDir'], + common_tools_var='VS120COMNTOOLS', + executable_path=r'Common7\IDE\WDExpress.exe', + batch_file_path=r'Common7\Tools\vsvars32.bat', + supported_arch=['x86', 'amd64'], + ), + + # Visual Studio 2012 VisualStudio('11.0', - sdk_version='6.1', + sdk_version='8.0A', hkeys=[r'Microsoft\VisualStudio\11.0\Setup\VS\ProductDir'], common_tools_var='VS110COMNTOOLS', executable_path=r'Common7\IDE\devenv.com', batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 11', supported_arch=['x86', 'amd64'], ), - # Visual C++ 11 Express Edition - # The batch file we look for is in the VC directory, - # so the VCExpress.exe executable is up in ..\..\Common7\IDE. + # Visual C++ 2012 Express Edition (for Desktop) VisualStudio('11.0Exp', vc_version='11.0', - sdk_version='6.1', - hkeys=[r'Microsoft\VCExpress\11.0\Setup\VS\ProductDir'], + sdk_version='8.0A', + hkeys=[r'Microsoft\VisualStudio\11.0\Setup\VS\ProductDir'], common_tools_var='VS110COMNTOOLS', - executable_path=r'Common7\IDE\VCExpress.exe', + executable_path=r'Common7\IDE\WDExpress.exe', batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 11', - supported_arch=['x86'], + supported_arch=['x86', 'amd64'], ), # Visual Studio 2010 - # The batch file we look for is in the VC directory, - # so the devenv.com executable is up in ..\..\Common7\IDE. VisualStudio('10.0', - sdk_version='6.1', + sdk_version='7.0A', hkeys=[r'Microsoft\VisualStudio\10.0\Setup\VS\ProductDir'], common_tools_var='VS100COMNTOOLS', executable_path=r'Common7\IDE\devenv.com', batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 10', supported_arch=['x86', 'amd64'], ), # Visual C++ 2010 Express Edition - # The batch file we look for is in the VC directory, - # so the VCExpress.exe executable is up in ..\..\Common7\IDE. VisualStudio('10.0Exp', vc_version='10.0', - sdk_version='6.1', + sdk_version='7.0A', hkeys=[r'Microsoft\VCExpress\10.0\Setup\VS\ProductDir'], common_tools_var='VS100COMNTOOLS', executable_path=r'Common7\IDE\VCExpress.exe', batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 10', supported_arch=['x86'], ), # Visual Studio 2008 - # The batch file we look for is in the VC directory, - # so the devenv.com executable is up in ..\..\Common7\IDE. VisualStudio('9.0', - sdk_version='6.1', + sdk_version='6.0A', hkeys=[r'Microsoft\VisualStudio\9.0\Setup\VS\ProductDir'], common_tools_var='VS90COMNTOOLS', executable_path=r'Common7\IDE\devenv.com', batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 9', supported_arch=['x86', 'amd64'], ), # Visual C++ 2008 Express Edition - # The batch file we look for is in the VC directory, - # so the VCExpress.exe executable is up in ..\..\Common7\IDE. VisualStudio('9.0Exp', vc_version='9.0', - sdk_version='6.1', + sdk_version='6.0A', hkeys=[r'Microsoft\VCExpress\9.0\Setup\VS\ProductDir'], common_tools_var='VS90COMNTOOLS', executable_path=r'Common7\IDE\VCExpress.exe', batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 9', supported_arch=['x86'], ), # Visual Studio 2005 - # The batch file we look for is in the VC directory, - # so the devenv.com executable is up in ..\..\Common7\IDE. VisualStudio('8.0', sdk_version='6.0A', hkeys=[r'Microsoft\VisualStudio\8.0\Setup\VS\ProductDir'], @@ -306,8 +291,6 @@ SupportedVSList = [ ), # Visual C++ 2005 Express Edition - # The batch file we look for is in the VC directory, - # so the VCExpress.exe executable is up in ..\..\Common7\IDE. VisualStudio('8.0Exp', vc_version='8.0Exp', sdk_version='6.0A', @@ -320,8 +303,6 @@ SupportedVSList = [ ), # Visual Studio .NET 2003 - # The batch file we look for is in the Common7\Tools directory, - # so the devenv.com executable is next door in ..\IDE. VisualStudio('7.1', sdk_version='6.0', hkeys=[r'Microsoft\VisualStudio\7.1\Setup\VS\ProductDir'], @@ -333,8 +314,6 @@ SupportedVSList = [ ), # Visual Studio .NET - # The batch file we look for is in the Common7\Tools directory, - # so the devenv.com executable is next door in ..\IDE. VisualStudio('7.0', sdk_version='2003R2', hkeys=[r'Microsoft\VisualStudio\7.0\Setup\VS\ProductDir'], @@ -393,11 +372,11 @@ def reset_installed_visual_studios(): InstalledVSMap = None for vs in SupportedVSList: vs.reset() - + # Need to clear installed VC's as well as they are used in finding # installed VS's SCons.Tool.MSCommon.vc.reset_installed_vcs() - + # We may be asked to update multiple construction environments with # SDK information. When doing this, we check on-disk for whether @@ -462,7 +441,7 @@ def get_default_version(env): If no version was requested by the user through the MSVS environment variable, query all the available the visual studios through - query_versions, and take the highest one. + get_installed_visual_studios, and take the highest one. Return ------ @@ -470,6 +449,7 @@ def get_default_version(env): the default version. """ if 'MSVS' not in env or not SCons.Util.is_Dict(env['MSVS']): + # get all versions, and remember them for speed later versions = [vs.version for vs in get_installed_visual_studios()] env['MSVS'] = {'VERSIONS' : versions} else: @@ -479,6 +459,8 @@ def get_default_version(env): if versions: env['MSVS_VERSION'] = versions[0] #use highest version by default else: + debug('get_default_version: WARNING: no installed versions found, ' + 'using first in SupportedVSList (%s)'%SupportedVSList[0].version) env['MSVS_VERSION'] = SupportedVSList[0].version env['MSVS']['VERSION'] = env['MSVS_VERSION'] diff --git a/src/engine/SCons/Tool/msvc.xml b/src/engine/SCons/Tool/msvc.xml index ca068a4..13ce567 100644 --- a/src/engine/SCons/Tool/msvc.xml +++ b/src/engine/SCons/Tool/msvc.xml @@ -347,9 +347,27 @@ If &cv-MSVC_VERSION; is not set, SCons will (by default) select the latest version of Visual C/C++ installed on your system. If the specified version isn't installed, tool initialization will fail. This variable must be passed as an argument to the Environment() -constructor; setting it later has no effect. Set it to an unexpected -value (e.g. "XXX") to see the valid values on your system. +constructor; setting it later has no effect. </para> + +<para> +Valid values for Windows are +<literal>12.0Exp</literal>, +<literal>11.0</literal>, +<literal>11.0Exp</literal>, +<literal>10.0</literal>, +<literal>10.0Exp</literal>, +<literal>9.0</literal>, +<literal>9.0Exp</literal>, +<literal>8.0</literal>, +<literal>8.0Exp</literal>, +<literal>7.1</literal>, +<literal>7.0</literal>, +and <literal>6.0</literal>. +Versions ending in <literal>Exp</literal> refer to "Express" or +"Express for Desktop" editions. +</para> + </summary> </cvar> diff --git a/src/engine/SCons/Tool/msvsTests.py b/src/engine/SCons/Tool/msvsTests.py index 7d966c1..3a9cac7 100644 --- a/src/engine/SCons/Tool/msvsTests.py +++ b/src/engine/SCons/Tool/msvsTests.py @@ -30,6 +30,7 @@ import unittest import copy from SCons.Tool.msvs import * +from SCons.Tool.MSCommon.vs import SupportedVSList import SCons.Util import SCons.Warnings @@ -547,15 +548,17 @@ class msvsTestCase(unittest.TestCase): def test_get_default_version(self): """Test retrieval of the default visual studio version""" - + debug("Testing for default version %s"%self.default_version) env = DummyEnv() v1 = get_default_version(env) if v1: assert env['MSVS_VERSION'] == self.default_version, \ - ("env['MSVS_VERSION'] != self.default_version",self.default_version, env['MSVS_VERSION']) + ("env['MSVS_VERSION'] != self.default_version", + env['MSVS_VERSION'],self.default_version) assert env['MSVS']['VERSION'] == self.default_version, \ - ("env['MSVS']['VERSION'] != self.default_version",self.default_version, env['MSVS']['VERSION']) + ("env['MSVS']['VERSION'] != self.default_version", + env['MSVS']['VERSION'], self.default_version) assert v1 == self.default_version, (self.default_version, v1) env = DummyEnv({'MSVS_VERSION':'7.0'}) @@ -701,7 +704,7 @@ class msvs80TestCase(msvsTestCase): class msvsEmptyTestCase(msvsTestCase): """Test Empty Registry""" registry = DummyRegistry(regdata_none) - default_version = '11.0' + default_version = SupportedVSList[0].version highest_version = None number_of_versions = 0 install_locs = { @@ -724,7 +727,7 @@ if __name__ == "__main__": SCons.Util.RegEnumKey = DummyEnumKey SCons.Util.RegEnumValue = DummyEnumValue SCons.Util.RegQueryValueEx = DummyQueryValue - + os.path.exists = DummyExists # make sure all files exist :-) os.path.isfile = DummyExists # make sure all files are files :-) os.path.isdir = DummyExists # make sure all dirs are dirs :-) diff --git a/testing/README.md b/testing/README.md new file mode 100644 index 0000000..bb81ce2 --- /dev/null +++ b/testing/README.md @@ -0,0 +1,7 @@ +Here lie various files related to SCons that +can not find the place in other directories: + + buildbot.yml - Ansible playbook to set up + buildbot for running tests + + buildbot.hosts - Ansible inventory file diff --git a/testing/buildbot.hosts b/testing/buildbot.hosts new file mode 100644 index 0000000..3e0be7d --- /dev/null +++ b/testing/buildbot.hosts @@ -0,0 +1 @@ +localhost ansible_connection=local builder=xxx pass=xxx
\ No newline at end of file diff --git a/testing/buildbot.yml b/testing/buildbot.yml new file mode 100644 index 0000000..81c2143 --- /dev/null +++ b/testing/buildbot.yml @@ -0,0 +1,80 @@ +# Ansible playbook to setup buildbot instance. +# Edit buildbot.hosts to set builder and pass variables. +# Then exec: +# +# ansible-playbook -i buildbot.hosts buildbot.yml +# +# botuser can be overridden from command line: +# +# ansible-playbook -i hosts buildbot.yml -e 'botuser=sconsy' +# +# Tested with Ansible 1.5.0, based on +# http://scons.org/wiki/InstallingBuildbotSlaves +# Send questions to: +# +# anatoly techtonik <techtonik@gmail.com> +# +--- +# host is overridable with --extra-vars 'host=address' +- hosts: "{{ host | default('localhost') }}" + vars: + # botuser can be overridden with -e 'botuser=scons2' + - botuser: scons + - hgrc: /home/{{ botuser }}/.hgrc + - venv: /home/{{ botuser }}/buildbot-virtualenv + - work: /home/{{ botuser }}/buildbot-workdir + + vars_prompt: + - name: maintainer + prompt: contact details of the builbot owner + default: name <mail@example.com> + private: no + + tasks: + # --- install requirements --- + - name: ubuntu/debian - make sure mercurial is installed + apt: pkg={{ item }} + with_items: + - mercurial + - python-virtualenv + + # --- enable mercurial purge extension --- + - name: create .hgrc if necessary + stat: path={{ hgrc }} + register: st + - file: path={{ hgrc }} owner={{ botuser }} state=touch + when: not st.stat.exists + - name: enable mercurial purge extension + ini_file: dest={{ hgrc }} + section=extensions option=hgext.purge + value= + + - name: install buildbot-slave in virtualenv + pip: name=buildbot-slave virtualenv={{ venv }} + + - name: create buildbot environment + command: "{{ venv }}/bin/buildslave create-slave + {{ work }} buildbot.scons.org:9989 {{ builder }} {{ pass }} + creates={{ work }}" + sudo: yes + sudo_user: "{{ botuser }}" + + - name: set contact details of the buildbot owner + copy: dest="{{ work }}/info/admin" content="{{ maintainer }}" + notify: + - restart buildbot + + - name: update host information + copy: dest="{{ work }}/info/host" + content="{{ansible_lsb.description}} + {{'\n'}}{{ansible_machine}} + {{'\n'}}{{ansible_memtotal_mb}}MB RAM + {{'\n'}}Python {{ansible_python_version}}" + notify: + - restart buildbot + + handlers: + - name: restart buildbot + command: "{{ venv }}/bin/buildslave restart {{ work }}" + sudo: yes + sudo_user: "{{ botuser }}" |