#!/usr/bin/env python\r
# encoding: utf-8\r
#\r
-# Copyright 2009 Develer S.r.l. (http://www.develer.com/)\r
-# All rights reserved.\r
+# This file is part of BeRTOS.\r
+#\r
+# Bertos is free software; you can redistribute it and/or modify\r
+# it under the terms of the GNU General Public License as published by\r
+# the Free Software Foundation; either version 2 of the License, or\r
+# (at your option) any later version.\r
+#\r
+# This program is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU General Public License for more details.\r
+#\r
+# You should have received a copy of the GNU General Public License\r
+# along with this program; if not, write to the Free Software\r
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\r
+#\r
+# As a special exception, you may use this file as part of a free software\r
+# library without restriction. Specifically, if other files instantiate\r
+# templates or use macros or inline functions from this file, or you compile\r
+# this file and link it with other files to produce an executable, this\r
+# file does not by itself cause the resulting executable to be covered by\r
+# the GNU General Public License. This exception does not however\r
+# invalidate any other reasons why the executable file might be covered by\r
+# the GNU General Public License.\r
+#\r
+# Copyright 2008 Develer S.r.l. (http://www.develer.com/)\r
#\r
# $Id: qvariant_converter.py 2506 2009-04-15 08:29:07Z duplo $\r
#\r
\r
from _winreg import *\r
\r
-DIR_KEY = OpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Develer\BeRTOS SDK\BeRTOS Dirs")\r
-TOOLCHAIN_KEY = OpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Develer\BeRTOS SDK\Toolchain Executables")\r
+# Open the registry keys. When the keys don't exist it do nothing\r
+try:\r
+ DIR_KEY = OpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Develer\BeRTOS SDK\BeRTOS Dirs")\r
+except WindowsError:\r
+ DIR_KEY = None\r
+\r
+try:\r
+ TOOLCHAIN_KEY = OpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Develer\BeRTOS SDK\Toolchain Executables")\r
+except WindowsError:\r
+ TOOLCHAIN_KEY = None\r
+\r
+try:\r
+ CLI_KEY = OpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Develer\BeRTOS SDK\Ide Command Lines")\r
+except WindowsError:\r
+ CLI_KEY = None\r
\r
def getBertosDirs():\r
"""\r
Returns the path of the BeRTOS versions installed by the BeRTOS SDK installer.\r
"""\r
- return getFromRegistry(DIR_KEY)\r
+ return getFromRegistry(DIR_KEY).values()\r
\r
-def getBertosToolchain():\r
+def getBertosToolchains():\r
"""\r
Returns the path of the executables of the toolchains installed by the BeRTOS\r
SDK installer.\r
"""\r
- return getFromRegistry(TOOLCHAIN_KEY)\r
+ return getFromRegistry(TOOLCHAIN_KEY).values()\r
+\r
+def getCommandLines():\r
+ """\r
+ Returns the command lines to launch in order to open the selected IDE.\r
+ """\r
+ return getFromRegistry(CLI_KEY)\r
\r
def getFromRegistry(key):\r
"""\r
Returns the value of all the named values of the given key.\r
"""\r
index = 0\r
- items = []\r
- while True:\r
- try:\r
- item = EnumValue(TOOLCHAIN_KEY, index)[1]\r
- items.append(item)\r
- except WindowsError:\r
- break\r
+ items = {}\r
+ if key:\r
+ while True:\r
+ try:\r
+ item = EnumValue(key, index)\r
+ items[item[0]] = item[1]\r
+ index += 1\r
+ except WindowsError:\r
+ break\r
return items
\ No newline at end of file