Commits

Anonymous committed 159cb64

check if entry_points.txt has console_scripts section (fixes #25), thanks Sergey Schetinin

Comments (0)

Files changed (1)

         if dist.has_metadata('entry_points.txt'):
             config = ConfigParser.SafeConfigParser()
             config.readfp(FakeFile(dist.get_metadata_lines('entry_points.txt')))
-            for name, value in config.items('console_scripts'):
-                paths_to_remove.add(os.path.join(bin_py, name))
-                if sys.platform == 'win32':
-                    paths_to_remove.add(os.path.join(bin_py, name) + '.exe')
-                    paths_to_remove.add(os.path.join(bin_py, name) + '-script.py')
+            if config.has_section('console_scripts'):
+                for name, value in config.items('console_scripts'):
+                    paths_to_remove.add(os.path.join(bin_py, name))
+                    if sys.platform == 'win32':
+                        paths_to_remove.add(os.path.join(bin_py, name) + '.exe')
+                        paths_to_remove.add(os.path.join(bin_py, name) + '-script.py')
 
         paths_to_remove.remove(auto_confirm)
         self.uninstalled = paths_to_remove