migration.py
changeset 8119 29cdde6bb9ef
parent 8056 8909800a8c51
parent 8108 91868ec92391
child 8532 28a346df670e
equal deleted inserted replaced
8116:6510654269a6 8119:29cdde6bb9ef
   268 type "exit" or Ctrl-D to quit the shell and resume operation"""
   268 type "exit" or Ctrl-D to quit the shell and resume operation"""
   269         # give custom readfunc to avoid http://bugs.python.org/issue1288615
   269         # give custom readfunc to avoid http://bugs.python.org/issue1288615
   270         def unicode_raw_input(prompt):
   270         def unicode_raw_input(prompt):
   271             return unicode(raw_input(prompt), sys.stdin.encoding)
   271             return unicode(raw_input(prompt), sys.stdin.encoding)
   272         interact(banner, readfunc=unicode_raw_input, local=local_ctx)
   272         interact(banner, readfunc=unicode_raw_input, local=local_ctx)
   273         readline.write_history_file(histfile)
   273         try:
       
   274             readline.write_history_file(histfile)
       
   275         except IOError:
       
   276             pass
   274         # delete instance's confirm attribute to avoid questions
   277         # delete instance's confirm attribute to avoid questions
   275         del self.confirm
   278         del self.confirm
   276         self.need_wrap = True
   279         self.need_wrap = True
   277 
   280 
   278     @cached
   281     @cached
   410             toremove = (cube,)
   413             toremove = (cube,)
   411         origcubes = self.config._cubes
   414         origcubes = self.config._cubes
   412         basecubes = [c for c in origcubes if not c in toremove]
   415         basecubes = [c for c in origcubes if not c in toremove]
   413         self.config._cubes = tuple(self.config.expand_cubes(basecubes))
   416         self.config._cubes = tuple(self.config.expand_cubes(basecubes))
   414         removed = [p for p in origcubes if not p in self.config._cubes]
   417         removed = [p for p in origcubes if not p in self.config._cubes]
   415         if not cube in removed:
   418         if not cube in removed and cube in origcubes:
   416             raise ConfigurationError("can't remove cube %s, "
   419             raise ConfigurationError("can't remove cube %s, "
   417                                      "used as a dependency" % cube)
   420                                      "used as a dependency" % cube)
   418         return removed
   421         return removed
   419 
   422 
   420     def rewrite_configuration(self):
   423     def rewrite_configuration(self):