[Cvsshell-devel] CVS: cvsshell install.py,1.3,1.4
Status: Beta
Brought to you by:
stefanheimann
From: Stefan H. <ste...@us...> - 2002-05-27 06:33:28
|
Update of /cvsroot/cvsshell/cvsshell In directory usw-pr-cvs1:/tmp/cvs-serv2307 Modified Files: install.py Log Message: added support for migrating cvsroot aliases to new rc-file. Index: install.py =================================================================== RCS file: /cvsroot/cvsshell/cvsshell/install.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** install.py 11 Mar 2002 12:02:13 -0000 1.3 --- install.py 27 May 2002 06:33:24 -0000 1.4 *************** *** 25,32 **** thisDir = os.path.join(os.getcwd(), sys.path[0]) ! sys.path.insert(1, os.path.join(thisDir, 'src')) from interactive_app import InteractiveApp ! from cvs_shell import NAME, VERSION, COPYRIGHT, BUG_ADDRESS ! class Installation(InteractiveApp): --- 25,31 ---- thisDir = os.path.join(os.getcwd(), sys.path[0]) ! sys.path.insert(0, os.path.join(thisDir, 'src')) from interactive_app import InteractiveApp ! from cvs_shell import NAME, VERSION, COPYRIGHT, BUG_ADDRESS, CvsShell class Installation(InteractiveApp): *************** *** 41,44 **** --- 40,45 ---- self.cvsDir = None self.initOptions('') + self.rcFile = os.path.join(self.HOME,'.cvsshellrc') + self.defaultRcFile = os.path.join(thisDir, 'etc', 'default-cvsshellrc') *************** *** 69,75 **** def start(self): InteractiveApp.start(self) - if self.onWindows: - pass #self.exit("Windows is currently not supported. I am working on it.") - def inPath(self, dir): --- 70,73 ---- *************** *** 83,86 **** --- 81,85 ---- self.printMsg(failureMsg) return + self.migrateRCFile() startup, content = self.createStartScript() try: *************** *** 98,101 **** --- 97,126 ---- self.printMsg('You can also click the icon of this file in the explorer.') + def migrateRCFile(self): + if os.path.exists(self.rcFile): + answ = self.prompt('The default .cvsshellrc file has changed. Should I install\n' + 'the new version? Aliases for cvsroots will be transfaired\n' + 'from the old configuration file to the new .cvsshellrc file.\n' + '(yes|no) ') + if answ == 'yes': + errorMsg = 'Could not migrate the .cvsshellrc file.' + app = CvsShell() + aliases = app.cvsRootAliases + rcFileCopy = self.rcFile + '-saved' + try: + os.rename(self.rcFile, rcFileCopy) + except OSError, msg: + self.printErr(msg) + self.printErr(errorMsg) + return + import shutil + shutil.copyfile(self.defaultRcFile,self.rcFile) + lines = [] + for a in aliases.items(): + lines.append('%s = %s' % a) + app.appendToSection('CVSROOT', lines) + + + def createStartScript(self): |