def recursive_dict(element):
     if isinstance(element, Text):
         value = str(element.data).replace("\\", "/") if not isWindows() else str(element.data)
         return "#text", str(value)
     contents = {}
     if element.attributes is not None:
         for name, value in element.attributes.items():
             _value = str(value).replace("\\", "/") if not isWindows() else str(value)
             contents.setdefault(str(name), []).append(_value)
     children = map(recursive_dict, element.childNodes)
     if children:
         for name, value in children:
             contents.setdefault(str(name), []).append(value)
     return str(element.nodeName), contents
 def __buildLaunchConfiguration(self):
     cwd = os.path.abspath(".")
     program = os.path.join(cwd, attributes.OUTPUT_DIRECTORY,
                            self._contents.outputName,
                            'ide_' + self._contents.name, "bin",
                            nameExecutable(self._contents.outputName))
     debug = dict(
         name="Debug {0}".format(self._contents.name),
         cwd=cwd,
         program=program,
         preLaunchTask="Build",
         request="launch",
         args=[],
         environment=[],
         stopAtEntry=False,
         externalConsole=False,
     )
     if isWindows():
         debug["type"] = "cppvsdbg"
     else:
         setupCommands = [
             dict(description="Enable pretty-printing for gdb",
                  text="-enable-pretty-printing",
                  ignoreFailures=True),
         ]
         debug.update(
             dict(type="cppdbg", MIMode="gdb", setupCommands=setupCommands))
     self._workspace["launch"] = {"configurations": [debug]}
Ejemplo n.º 3
0
 def setUpClass(cls):
     MsvsWriterTestCase.setUpClass()
     cls.PROJECT_TEMPLATE = re.sub(
         r">[\s\n\r]+<", '><',
         readTextFileAtOnce(TEST_VCPROJ_TEMPLATE_FILE))
     if not isWindows():
         cls.PROJECT_TEMPLATE = cls.PROJECT_TEMPLATE.replace("\\", "/")
 def skipWindowsTest(self):
     if not isWindows():
         self.skipTest("This test supported in Windows only")
 def _doBeforeSetup(self):
     self.isOnWindows = isWindows()
Ejemplo n.º 6
0
 def test_isWindows(self):
     self.patch(CUT, 'platform.system', side_effect=['linux', 'Windows'])
     self.assertFalse(services.isWindows())
     self.assertTrue(services.isWindows())