Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8.1, 0.8.2, and 0.8.3

thgconfig: fail more gracefully when iniparse is not found

Changeset ed5d831928be

Parent 6da01818c9ea

by Steve Borho

Changes to one file · Browse files at ed5d831928be Showing diff from parent 6da01818c9ea Diff from another changeset...

 
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 
444
445
446
447
 
 
 
 
 
 
 
 
 
 
 
 
 
 
448
449
450
 
936
937
938
 
939
940
941
 
19
20
21
 
 
 
 
 
 
 
 
 
 
22
23
24
 
434
435
436
 
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
 
939
940
941
942
943
944
945
@@ -19,16 +19,6 @@
   from hggtk import dialog, gdialog, gtklib, hgcmd   -try: - from mercurial import demandimport - demandimport.disable() - import iniparse - demandimport.enable() -except ImportError: - print 'The iniparse python package is required by this tool. Download from' - print 'http://code.google.com/p/iniparse/' - sys.exit(0) -  _unspecstr = _('<unspecified>')  _unspeclocalstr = hglib.fromutf(_unspecstr)   @@ -444,7 +434,20 @@
  if configrepo:   dialog.error_dialog(self, _('No repository found'),   _('no repo at ') + root) - self.response(None, gtk.RESPONSE_CANCEL) + self.destroy() + return + + try: + from mercurial import demandimport + demandimport.disable() + import iniparse + demandimport.enable() + except ImportError: + dialog.error_dialog(self, _('Iniparse package not found'), + _('Please install iniparse package')) + self.destroy() + print 'Please install http://code.google.com/p/iniparse/' + return     # Catch close events   self.connect('response', self.should_live) @@ -936,6 +939,7 @@
  f.write(_('# Generated by tortoisehg-config\n'))   f.close()   self.fn = fn + import iniparse   return iniparse.INIConfig(file(fn), optionxformvalue=None)     def record_new_value(self, cpath, newvalue, keephistory=True):