Description: Drop Windows debugging tools
 Drop uVision from list of candidate debugging tools
Author: Nick Morrott <knowledgejunkie@gmail.com>
Forwarded: not-needed
Last-Update: 2018-12-28
---
--- a/valinor/ide_detection.py
+++ b/valinor/ide_detection.py
@@ -25,43 +25,12 @@
 
 # preferred order of IDEs if multiple are available
 IDE_Preference = [
-    'uvision', 'uvision5', 'arm_none_eabi_gdb', 'gdb'
+    'arm_none_eabi_gdb', 'gdb'
 ]
 
 
 logger = logging.getLogger('ide_detect')
 
-def _read_hklm_reg_value(key_path, value_name):
-    ''' read a value from a registry key under HKEY_LOCAL_MACHINE '''
-    if os.name != 'nt':
-        return None
-    import _winreg as winreg
-
-    k = None
-    value = None
-    try:
-        k = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, key_path)
-        v = winreg.QueryValueEx(k, value_name)
-        return v[0]
-    except WindowsError:
-        if k:
-            winreg.CloseKey(k)
-    return value
-
-def _find_uvision():
-    found = find_executable('UV4')
-    if found: return found
-    if os.name == 'nt':
-        found_pathdir = _read_hklm_reg_value(r'Software\Keil\Products\MDK', 'Path')
-        if not found_pathdir:
-            found_pathdir = _read_hklm_reg_value(r'Software\Wow6432Node\Keil\Products\MDK', 'Path')
-        if found_pathdir:
-            found = os.path.join(found_pathdir, '..', 'UV4', 'UV4.exe')
-            if os.path.isfile(found):
-                return os.path.normpath(found)
-    return None
-
-
 def _find_generic_gdb():
     return find_executable('gdb')
 
@@ -69,24 +38,7 @@
 def _find_arm_none_eabi_gdb():
     return find_executable('gdb')
 
-
-def _uvision_launcher(uvision_exe):
-    def launch_uvision(projectfiles, executable):
-        uvproj = [
-            x for x in projectfiles if x.endswith('.uvproj') or x.endswith('.uvprojx')
-        ]
-        if len(uvproj) != 1:
-            raise Exception('Exactly one project file must be provided')
-        logger.info("launching uvision: %s %s", uvision_exe, uvproj[0])
-        child = subprocess.Popen(
-            [uvision_exe, uvproj[0]],
-        )
-        child.wait()
-    return launch_uvision
-
 IDE_Scanners = {
-              'uvision': (_find_uvision, _uvision_launcher),
-             'uvision5': (_find_uvision, _uvision_launcher),
                   'gdb': (_find_generic_gdb, gdb_launcher),
     'arm_none_eabi_gdb': (_find_arm_none_eabi_gdb, arm_none_eabi_gdb_launcher),
 }
--- a/valinor/main.py
+++ b/valinor/main.py
@@ -124,14 +124,7 @@
     project = Project(file_base_name, [project_data], project_settings)
     project.generate(ide_tool)
 
-    # perform any modifications to the executable itself that are necessary to
-    # debug it (for example, to debug an ELF with Keil uVision, it must be
-    # renamed to have the .axf extension)
     executable = args.executable
-    if ide_tool in ('uvision', 'uvision5'):
-        new_exe_path = args.executable + '.axf'
-        shutil.copy(args.executable, new_exe_path)
-        executable = new_exe_path
     projectfiles = project.get_generated_project_files(ide_tool)
     if not projectfiles:
         logging.error("failed to generate project files")
--- a/valinor/test/test_outputdir.py
+++ b/valinor/test/test_outputdir.py
@@ -33,27 +33,6 @@
         self.assertEqual(status, 0)
         return err or out
 
-    def testUVision(self):
-        def runWithDir(d=None):
-            args = [
-                '--tool', 'uvision',
-                '--target', 'K64F',
-                os.path.relpath(self.exe_path, self.workingdir),
-                '-n'
-            ]
-            if d:
-                args += ['-d', d]
-            out = self.runCheck(args)
-
-        runWithDir()
-        self.assertTrue(os.path.isfile(self.exe_path + '.uvproj'))
-
-        runWithDir('somesubdir')
-        self.assertTrue(os.path.isfile(os.path.join(self.workingdir, 'somesubdir', 'myexe.uvproj')))
-
-        runWithDir(os.path.join('somesubdir','anotherdir') + os.path.sep)
-        self.assertTrue(os.path.isfile(os.path.join(self.workingdir, 'somesubdir', 'anotherdir', 'myexe.uvproj')))
-
     def testARMNoneEABIGDB(self):
         def runWithDir(d=None):
             args = [
@@ -74,7 +53,3 @@
 
         runWithDir(os.path.join('somesubdir','anotherdir') + os.path.sep)
         self.assertTrue(os.path.isfile(os.path.join(self.workingdir, 'somesubdir', 'anotherdir', 'myexe.gdbstartup')))
-
-
-
-
