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