diff --git a/IPython/Extensions/ipy_pydb.py b/IPython/Extensions/ipy_pydb.py index f23aa65..10d9b71 100755 --- a/IPython/Extensions/ipy_pydb.py +++ b/IPython/Extensions/ipy_pydb.py @@ -1,31 +1,31 @@ -import inspect -import IPython.ipapi -from IPython.genutils import arg_split -ip = IPython.ipapi.get() - -from IPython import Debugger - -def call_pydb(self, args): - """Invoke pydb with the supplied parameters.""" - try: - import pydb - except ImportError: - raise ImportError("pydb doesn't seem to be installed.") - - if not hasattr(pydb.pydb, "runv"): - raise ImportError("You need pydb version 1.19 or later installed.") - - argl = arg_split(args) - # print argl # dbg - if len(inspect.getargspec(pydb.runv)[0]) == 2: - pdb = Debugger.Pdb() - ip.IP.history_saving_wrapper( lambda : pydb.runv(argl, pdb) )() - else: - ip.IP.history_saving_wrapper( lambda : pydb.runv(argl) )() - - -ip.expose_magic("pydb",call_pydb) - - - - +import inspect +import IPython.ipapi +from IPython.genutils import arg_split +ip = IPython.ipapi.get() + +from IPython import Debugger + +def call_pydb(self, args): + """Invoke pydb with the supplied parameters.""" + try: + import pydb + except ImportError: + raise ImportError("pydb doesn't seem to be installed.") + + if not hasattr(pydb.pydb, "runv"): + raise ImportError("You need pydb version 1.19 or later installed.") + + argl = arg_split(args) + # print argl # dbg + if len(inspect.getargspec(pydb.runv)[0]) == 2: + pdb = Debugger.Pdb() + ip.IP.history_saving_wrapper( lambda : pydb.runv(argl, pdb) )() + else: + ip.IP.history_saving_wrapper( lambda : pydb.runv(argl) )() + + +ip.expose_magic("pydb",call_pydb) + + + + diff --git a/IPython/Extensions/ipy_stock_completers.py b/IPython/Extensions/ipy_stock_completers.py index 9dbead2..00cc420 100755 --- a/IPython/Extensions/ipy_stock_completers.py +++ b/IPython/Extensions/ipy_stock_completers.py @@ -1,218 +1,218 @@ -""" Tab completion support for a couple of linux package managers - -This is also an example of how to write custom completer plugins -or hooks. - -Practical use: - -[ipython]|1> import ipy_linux_package_managers -[ipython]|2> apt-get u<<< press tab here >>> -update upgrade -[ipython]|2> apt-get up - -""" -import IPython.ipapi -import glob,os,shlex,sys - -ip = IPython.ipapi.get() - -def vcs_completer(commands, event): - """ utility to make writing typical version control app completers easier - - VCS command line apps typically have the format: - - [sudo ]PROGNAME [help] [command] file file... - - """ - - - cmd_param = event.line.split() - if event.line.endswith(' '): - cmd_param.append('') - - if cmd_param[0] == 'sudo': - cmd_param = cmd_param[1:] - - if len(cmd_param) == 2 or 'help' in cmd_param: - return commands.split() - - return ip.IP.Completer.file_matches(event.symbol) - - - -def apt_completers(self, event): - """ This should return a list of strings with possible completions. - - Note that all the included strings that don't start with event.symbol - are removed, in order to not confuse readline. - - """ - # print event # dbg - - # commands are only suggested for the 'command' part of package manager - # invocation - - cmd = (event.line + "").rsplit(None,1)[0] - # print cmd - if cmd.endswith('apt-get') or cmd.endswith('yum'): - return ['update', 'upgrade', 'install', 'remove'] - - # later on, add dpkg -l / whatever to get list of possible - # packages, add switches etc. for the rest of command line - # filling - - raise IPython.ipapi.TryNext - - -# re_key specifies the regexp that triggers the specified completer - -ip.set_hook('complete_command', apt_completers, re_key = '.*apt-get') -ip.set_hook('complete_command', apt_completers, re_key = '.*yum') - -pkg_cache = None - -def module_completer(self,event): - """ Give completions after user has typed 'import' """ - - # only a local version for py 2.4, pkgutil has no walk_packages() there - if sys.version_info < (2,5): - for el in [f[:-3] for f in glob.glob("*.py")]: - yield el - return - - global pkg_cache - import pkgutil,imp,time - #current = - if pkg_cache is None: - print "\n\n[Standby while scanning modules, this can take a while]\n\n" - pkg_cache = list(pkgutil.walk_packages()) - - already = set() - for ld, name, ispkg in pkg_cache: - if name.count('.') < event.symbol.count('.') + 1: - if name not in already: - already.add(name) - yield name + (ispkg and '.' or '') - return - -ip.set_hook('complete_command', module_completer, str_key = 'import') -ip.set_hook('complete_command', module_completer, str_key = 'from') - -svn_commands = """\ -add blame praise annotate ann cat checkout co cleanup commit ci copy -cp delete del remove rm diff di export help ? h import info list ls -lock log merge mkdir move mv rename ren propdel pdel pd propedit pedit -pe propget pget pg proplist plist pl propset pset ps resolved revert -status stat st switch sw unlock update -""" - -def svn_completer(self,event): - return vcs_completer(svn_commands, event) - -ip.set_hook('complete_command', svn_completer, str_key = 'svn') - -hg_commands = """ -add addremove annotate archive backout branch branches bundle cat -clone commit copy diff export grep heads help identify import incoming -init locate log manifest merge outgoing parents paths pull push -qapplied qclone qcommit qdelete qdiff qfold qguard qheader qimport -qinit qnew qnext qpop qprev qpush qrefresh qrename qrestore qsave -qselect qseries qtop qunapplied recover remove rename revert rollback -root serve showconfig status strip tag tags tip unbundle update verify -version -""" - -def hg_completer(self,event): - """ Completer for mercurial commands """ - - return vcs_completer(hg_commands, event) - -ip.set_hook('complete_command', hg_completer, str_key = 'hg') - - -bzr_commands = """ -add annotate bind branch break-lock bundle-revisions cat check -checkout commit conflicts deleted diff export gannotate gbranch -gcommit gdiff help ignore ignored info init init-repository inventory -log merge missing mkdir mv nick pull push reconcile register-branch -remerge remove renames resolve revert revno root serve sign-my-commits -status testament unbind uncommit unknowns update upgrade version -version-info visualise whoami -""" - -def bzr_completer(self,event): - """ Completer for bazaar commands """ - cmd_param = event.line.split() - if event.line.endswith(' '): - cmd_param.append('') - - if len(cmd_param) > 2: - cmd = cmd_param[1] - param = cmd_param[-1] - output_file = (param == '--output=') - if cmd == 'help': - return bzr_commands.split() - elif cmd in ['bundle-revisions','conflicts', - 'deleted','nick','register-branch', - 'serve','unbind','upgrade','version', - 'whoami'] and not output_file: - return [] - else: - # the rest are probably file names - return ip.IP.Completer.file_matches(event.symbol) - - return bzr_commands.split() - -ip.set_hook('complete_command', bzr_completer, str_key = 'bzr') - - -def runlistpy(self, event): - comps = shlex.split(event.line) - relpath = (len(comps) > 1 and comps[-1] or '') - - #print "rp",relpath # dbg - lglob = glob.glob - isdir = os.path.isdir - if relpath.startswith('~'): - relpath = os.path.expanduser(relpath) - dirs = [f.replace('\\','/') + "/" for f in lglob(relpath+'*') - if isdir(f)] - pys = [f.replace('\\','/') for f in lglob(relpath+'*.py') + lglob(relpath+'*.ipy')] - return dirs + pys - -ip.set_hook('complete_command', runlistpy, str_key = '%run') - -def cd_completer(self, event): - relpath = event.symbol - #print event # dbg - if '-b' in event.line: - # return only bookmark completions - bkms = self.db.get('bookmarks',{}) - return bkms.keys() - - - if event.symbol == '-': - # jump in directory history by number - ents = ['-%d [%s]' % (i,s) for i,s in enumerate(ip.user_ns['_dh'])] - if len(ents) > 1: - return ents - return [] - - if relpath.startswith('~'): - relpath = os.path.expanduser(relpath).replace('\\','/') - found = [] - for d in [f.replace('\\','/') + '/' for f in glob.glob(relpath+'*') - if os.path.isdir(f)]: - if ' ' in d: - # we don't want to deal with any of that, complex code - # for this is elsewhere - raise IPython.ipapi.TryNext - found.append( d ) - - if not found: - if os.path.isdir(relpath): - return [relpath] - raise IPython.ipapi.TryNext - return found - -ip.set_hook('complete_command', cd_completer, str_key = '%cd') +""" Tab completion support for a couple of linux package managers + +This is also an example of how to write custom completer plugins +or hooks. + +Practical use: + +[ipython]|1> import ipy_linux_package_managers +[ipython]|2> apt-get u<<< press tab here >>> +update upgrade +[ipython]|2> apt-get up + +""" +import IPython.ipapi +import glob,os,shlex,sys + +ip = IPython.ipapi.get() + +def vcs_completer(commands, event): + """ utility to make writing typical version control app completers easier + + VCS command line apps typically have the format: + + [sudo ]PROGNAME [help] [command] file file... + + """ + + + cmd_param = event.line.split() + if event.line.endswith(' '): + cmd_param.append('') + + if cmd_param[0] == 'sudo': + cmd_param = cmd_param[1:] + + if len(cmd_param) == 2 or 'help' in cmd_param: + return commands.split() + + return ip.IP.Completer.file_matches(event.symbol) + + + +def apt_completers(self, event): + """ This should return a list of strings with possible completions. + + Note that all the included strings that don't start with event.symbol + are removed, in order to not confuse readline. + + """ + # print event # dbg + + # commands are only suggested for the 'command' part of package manager + # invocation + + cmd = (event.line + "").rsplit(None,1)[0] + # print cmd + if cmd.endswith('apt-get') or cmd.endswith('yum'): + return ['update', 'upgrade', 'install', 'remove'] + + # later on, add dpkg -l / whatever to get list of possible + # packages, add switches etc. for the rest of command line + # filling + + raise IPython.ipapi.TryNext + + +# re_key specifies the regexp that triggers the specified completer + +ip.set_hook('complete_command', apt_completers, re_key = '.*apt-get') +ip.set_hook('complete_command', apt_completers, re_key = '.*yum') + +pkg_cache = None + +def module_completer(self,event): + """ Give completions after user has typed 'import' """ + + # only a local version for py 2.4, pkgutil has no walk_packages() there + if sys.version_info < (2,5): + for el in [f[:-3] for f in glob.glob("*.py")]: + yield el + return + + global pkg_cache + import pkgutil,imp,time + #current = + if pkg_cache is None: + print "\n\n[Standby while scanning modules, this can take a while]\n\n" + pkg_cache = list(pkgutil.walk_packages()) + + already = set() + for ld, name, ispkg in pkg_cache: + if name.count('.') < event.symbol.count('.') + 1: + if name not in already: + already.add(name) + yield name + (ispkg and '.' or '') + return + +ip.set_hook('complete_command', module_completer, str_key = 'import') +ip.set_hook('complete_command', module_completer, str_key = 'from') + +svn_commands = """\ +add blame praise annotate ann cat checkout co cleanup commit ci copy +cp delete del remove rm diff di export help ? h import info list ls +lock log merge mkdir move mv rename ren propdel pdel pd propedit pedit +pe propget pget pg proplist plist pl propset pset ps resolved revert +status stat st switch sw unlock update +""" + +def svn_completer(self,event): + return vcs_completer(svn_commands, event) + +ip.set_hook('complete_command', svn_completer, str_key = 'svn') + +hg_commands = """ +add addremove annotate archive backout branch branches bundle cat +clone commit copy diff export grep heads help identify import incoming +init locate log manifest merge outgoing parents paths pull push +qapplied qclone qcommit qdelete qdiff qfold qguard qheader qimport +qinit qnew qnext qpop qprev qpush qrefresh qrename qrestore qsave +qselect qseries qtop qunapplied recover remove rename revert rollback +root serve showconfig status strip tag tags tip unbundle update verify +version +""" + +def hg_completer(self,event): + """ Completer for mercurial commands """ + + return vcs_completer(hg_commands, event) + +ip.set_hook('complete_command', hg_completer, str_key = 'hg') + + +bzr_commands = """ +add annotate bind branch break-lock bundle-revisions cat check +checkout commit conflicts deleted diff export gannotate gbranch +gcommit gdiff help ignore ignored info init init-repository inventory +log merge missing mkdir mv nick pull push reconcile register-branch +remerge remove renames resolve revert revno root serve sign-my-commits +status testament unbind uncommit unknowns update upgrade version +version-info visualise whoami +""" + +def bzr_completer(self,event): + """ Completer for bazaar commands """ + cmd_param = event.line.split() + if event.line.endswith(' '): + cmd_param.append('') + + if len(cmd_param) > 2: + cmd = cmd_param[1] + param = cmd_param[-1] + output_file = (param == '--output=') + if cmd == 'help': + return bzr_commands.split() + elif cmd in ['bundle-revisions','conflicts', + 'deleted','nick','register-branch', + 'serve','unbind','upgrade','version', + 'whoami'] and not output_file: + return [] + else: + # the rest are probably file names + return ip.IP.Completer.file_matches(event.symbol) + + return bzr_commands.split() + +ip.set_hook('complete_command', bzr_completer, str_key = 'bzr') + + +def runlistpy(self, event): + comps = shlex.split(event.line) + relpath = (len(comps) > 1 and comps[-1] or '') + + #print "rp",relpath # dbg + lglob = glob.glob + isdir = os.path.isdir + if relpath.startswith('~'): + relpath = os.path.expanduser(relpath) + dirs = [f.replace('\\','/') + "/" for f in lglob(relpath+'*') + if isdir(f)] + pys = [f.replace('\\','/') for f in lglob(relpath+'*.py') + lglob(relpath+'*.ipy')] + return dirs + pys + +ip.set_hook('complete_command', runlistpy, str_key = '%run') + +def cd_completer(self, event): + relpath = event.symbol + #print event # dbg + if '-b' in event.line: + # return only bookmark completions + bkms = self.db.get('bookmarks',{}) + return bkms.keys() + + + if event.symbol == '-': + # jump in directory history by number + ents = ['-%d [%s]' % (i,s) for i,s in enumerate(ip.user_ns['_dh'])] + if len(ents) > 1: + return ents + return [] + + if relpath.startswith('~'): + relpath = os.path.expanduser(relpath).replace('\\','/') + found = [] + for d in [f.replace('\\','/') + '/' for f in glob.glob(relpath+'*') + if os.path.isdir(f)]: + if ' ' in d: + # we don't want to deal with any of that, complex code + # for this is elsewhere + raise IPython.ipapi.TryNext + found.append( d ) + + if not found: + if os.path.isdir(relpath): + return [relpath] + raise IPython.ipapi.TryNext + return found + +ip.set_hook('complete_command', cd_completer, str_key = '%cd') diff --git a/IPython/Extensions/jobctrl.py b/IPython/Extensions/jobctrl.py index c7ae4d0..bdde99c 100755 --- a/IPython/Extensions/jobctrl.py +++ b/IPython/Extensions/jobctrl.py @@ -1,61 +1,61 @@ -""" Preliminary "job control" extensions for IPython - -requires python 2.4 (or separate 'subprocess' module - -At the moment this is in a very "unhelpful" form, will be extended in the future. - -Usage: - -[ipython]|2> import jobctrl -[ipython]|3> &ls - <3> -[ipython]|4> _3.go ------------> _3.go() -ChangeLog -IPython -MANIFEST.in -README -README_Windows.txt - -... -""" - -from subprocess import Popen,PIPE -import os - -from IPython import genutils - -import IPython.ipapi - -class IpyPopen(Popen): - def go(self): - print self.communicate()[0] - def __repr__(self): - return '' % (self.line, self.pid) - - def kill(self): - assert os.name == 'nt' # xxx add posix version - os.system('taskkill /PID %d' % self.pid) - -def startjob(job): - p = IpyPopen(job, stdout=PIPE, shell = False) - p.line = job - return p - -def jobctrl_prefilter_f(self,line): - if line.startswith('&'): - pre,fn,rest = self.split_user_input(line[1:]) - - line = ip.IP.expand_aliases(fn,rest) - return '_ip.startjob(%s)' % genutils.make_quoted_expr(line) - - raise IPython.ipapi.TryNext - -def install(): - global ip - ip = IPython.ipapi.get() - # needed to make startjob visible as _ip.startjob('blah') - ip.startjob = startjob - ip.set_hook('input_prefilter', jobctrl_prefilter_f) - +""" Preliminary "job control" extensions for IPython + +requires python 2.4 (or separate 'subprocess' module + +At the moment this is in a very "unhelpful" form, will be extended in the future. + +Usage: + +[ipython]|2> import jobctrl +[ipython]|3> &ls + <3> +[ipython]|4> _3.go +-----------> _3.go() +ChangeLog +IPython +MANIFEST.in +README +README_Windows.txt + +... +""" + +from subprocess import Popen,PIPE +import os,shlex + +from IPython import genutils + +import IPython.ipapi + +class IpyPopen(Popen): + def go(self): + print self.communicate()[0] + def __repr__(self): + return '' % (self.line, self.pid) + + def kill(self): + assert os.name == 'nt' # xxx add posix version + os.system('taskkill /PID %d' % self.pid) + +def startjob(job): + p = IpyPopen(shlex.split(job), stdout=PIPE, shell = False) + p.line = job + return p + +def jobctrl_prefilter_f(self,line): + if line.startswith('&'): + pre,fn,rest = self.split_user_input(line[1:]) + + line = ip.IP.expand_aliases(fn,rest) + return '_ip.startjob(%s)' % genutils.make_quoted_expr(line) + + raise IPython.ipapi.TryNext + +def install(): + global ip + ip = IPython.ipapi.get() + # needed to make startjob visible as _ip.startjob('blah') + ip.startjob = startjob + ip.set_hook('input_prefilter', jobctrl_prefilter_f) + install() \ No newline at end of file diff --git a/IPython/Extensions/ledit.py b/IPython/Extensions/ledit.py index 6c83989..87683b4 100755 --- a/IPython/Extensions/ledit.py +++ b/IPython/Extensions/ledit.py @@ -1,98 +1,98 @@ -""" Fun magic line editor for ipython - -Use this to easily edit lists of strings gradually without crafting long -list comprehensions. - -'l' is the magic variable name for every line (array element). Save the current -result (or more exactly, retrieve the last ipython computation result into -%led work area) by running '%led s'. Just run '%led' to show the current work -area data. - -Example use: - -[ipython]|25> setups = !ls *setup*.py - == -['eggsetup.py', 'setup.py', 'setup_bdist_egg.py'] -[ipython]|26> setups - <26> ['eggsetup.py', 'setup.py', 'setup_bdist_egg.py'] -[ipython]|27> %led s -Data set from last result (_) - <27> ['eggsetup.py', 'setup.py', 'setup_bdist_egg.py'] -[ipython]|28> %led upper -cmd translated => l.upper() - <28> ['EGGSETUP.PY', 'SETUP.PY', 'SETUP_BDIST_EGG.PY'] -[ipython]|29> %led -Magic line editor (for lists of strings) -current data is: -['eggsetup.py', 'setup.py', 'setup_bdist_egg.py'] -[ipython]|30> %led upper -cmd translated => l.upper() - <30> ['EGGSETUP.PY', 'SETUP.PY', 'SETUP_BDIST_EGG.PY'] -[ipython]|31> %led s -Data set from last result (_) - <31> ['EGGSETUP.PY', 'SETUP.PY', 'SETUP_BDIST_EGG.PY'] -[ipython]|32> %led "n:" + l - <32> ['n:EGGSETUP.PY', 'n:SETUP.PY', 'n:SETUP_BDIST_EGG.PY'] -[ipython]|33> %led s -Data set from last result (_) - <33> ['n:EGGSETUP.PY', 'n:SETUP.PY', 'n:SETUP_BDIST_EGG.PY'] -[ipython]|34> %led l. -l.__add__ l.__gt__ l.__reduce_ex__ l.endswith l.join l.rstrip -l.__class__ l.__hash__ l.__repr__ l.expandtabs l.ljust l.split - -... (completions for string variable shown ) ... - -""" -import IPython.ipapi -import pprint -ip = IPython.ipapi.get() - -curdata = [] - -def line_edit_f(self, cmd ): - global curdata - - if not cmd: - - print "Magic line editor (for lists of strings)" - if curdata: - print "current data is:" - pprint.pprint(curdata) - else: - print "No current data, you should set it by running '%led s'" - print "When you have your data in _ (result of last computation)." - return - - if cmd == 's': - curdata = ip.ev('_') - print "Data set from last result (_)" - newlines = curdata - - else: - # simple method call, e.g. upper - if cmd.isalpha(): - cmd = 'l.' + cmd + '()' - print "cmd translated =>",cmd - - newlines = [] - for l in curdata: - try: - l2 = eval(cmd) - except Exception,e: - print "Dropping exception",e,"on line:",l - continue - newlines.append(l2) - - - return newlines - -def line_edit_complete_f(self,event): - """ Show all string methods in completions """ - if event.symbol.startswith('l.'): - return ['l.' + func for func in dir('')] - - return dir('') + ['l.' + func for func in dir('')] - -ip.set_hook('complete_command', line_edit_complete_f , str_key = '%led') - +""" Fun magic line editor for ipython + +Use this to easily edit lists of strings gradually without crafting long +list comprehensions. + +'l' is the magic variable name for every line (array element). Save the current +result (or more exactly, retrieve the last ipython computation result into +%led work area) by running '%led s'. Just run '%led' to show the current work +area data. + +Example use: + +[ipython]|25> setups = !ls *setup*.py + == +['eggsetup.py', 'setup.py', 'setup_bdist_egg.py'] +[ipython]|26> setups + <26> ['eggsetup.py', 'setup.py', 'setup_bdist_egg.py'] +[ipython]|27> %led s +Data set from last result (_) + <27> ['eggsetup.py', 'setup.py', 'setup_bdist_egg.py'] +[ipython]|28> %led upper +cmd translated => l.upper() + <28> ['EGGSETUP.PY', 'SETUP.PY', 'SETUP_BDIST_EGG.PY'] +[ipython]|29> %led +Magic line editor (for lists of strings) +current data is: +['eggsetup.py', 'setup.py', 'setup_bdist_egg.py'] +[ipython]|30> %led upper +cmd translated => l.upper() + <30> ['EGGSETUP.PY', 'SETUP.PY', 'SETUP_BDIST_EGG.PY'] +[ipython]|31> %led s +Data set from last result (_) + <31> ['EGGSETUP.PY', 'SETUP.PY', 'SETUP_BDIST_EGG.PY'] +[ipython]|32> %led "n:" + l + <32> ['n:EGGSETUP.PY', 'n:SETUP.PY', 'n:SETUP_BDIST_EGG.PY'] +[ipython]|33> %led s +Data set from last result (_) + <33> ['n:EGGSETUP.PY', 'n:SETUP.PY', 'n:SETUP_BDIST_EGG.PY'] +[ipython]|34> %led l. +l.__add__ l.__gt__ l.__reduce_ex__ l.endswith l.join l.rstrip +l.__class__ l.__hash__ l.__repr__ l.expandtabs l.ljust l.split + +... (completions for string variable shown ) ... + +""" +import IPython.ipapi +import pprint +ip = IPython.ipapi.get() + +curdata = [] + +def line_edit_f(self, cmd ): + global curdata + + if not cmd: + + print "Magic line editor (for lists of strings)" + if curdata: + print "current data is:" + pprint.pprint(curdata) + else: + print "No current data, you should set it by running '%led s'" + print "When you have your data in _ (result of last computation)." + return + + if cmd == 's': + curdata = ip.ev('_') + print "Data set from last result (_)" + newlines = curdata + + else: + # simple method call, e.g. upper + if cmd.isalpha(): + cmd = 'l.' + cmd + '()' + print "cmd translated =>",cmd + + newlines = [] + for l in curdata: + try: + l2 = eval(cmd) + except Exception,e: + print "Dropping exception",e,"on line:",l + continue + newlines.append(l2) + + + return newlines + +def line_edit_complete_f(self,event): + """ Show all string methods in completions """ + if event.symbol.startswith('l.'): + return ['l.' + func for func in dir('')] + + return dir('') + ['l.' + func for func in dir('')] + +ip.set_hook('complete_command', line_edit_complete_f , str_key = '%led') + ip.expose_magic('led', line_edit_f) \ No newline at end of file diff --git a/IPython/Release.py b/IPython/Release.py index 1746c9f..03da77f 100644 --- a/IPython/Release.py +++ b/IPython/Release.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Release data for the IPython project. -$Id: Release.py 1976 2006-12-08 11:53:57Z vivainio $""" +$Id: Release.py 2010 2006-12-20 15:29:17Z vivainio $""" #***************************************************************************** # Copyright (C) 2001-2006 Fernando Perez @@ -22,12 +22,11 @@ name = 'ipython' # because bdist_rpm does not accept dashes (an RPM) convention, and # bdist_deb does not accept underscores (a Debian convention). -revision = '1975' +revision = '2007' -#version = '0.7.3.svn' - -version = '0.7.3b3.r' + revision.rstrip('M') +version = '0.7.3' +#version = '0.7.3rc2.r' + revision.rstrip('M') description = "An enhanced interactive Python shell." diff --git a/IPython/rlineimpl.py b/IPython/rlineimpl.py index 69a55b1..8f6beb5 100644 --- a/IPython/rlineimpl.py +++ b/IPython/rlineimpl.py @@ -1,54 +1,54 @@ -# -*- coding: utf-8 -*- -""" Imports and provides the "correct" version of readline for the platform. - -Readline is used throughout IPython as "import IPython.rlineimpl as readline. - -In addition to normal readline stuff, this module provides have_readline boolean -and _outputfile variable used in genutils. - -$Id: Magic.py 1096 2006-01-28 20:08:02Z vivainio $""" - - -import sys - -have_readline = False - -if sys.platform == 'win32': - try: - import pyreadline.rlmain - #add config for inputrcpath here: - #pyreadline.rlmain.config_path="c:/python/test_config.ini" - from readline import * - #print "Using the new pyreadline (thanks for participating in the testing!)" - - have_readline = True - - import readline as _rl - except ImportError: - #print "IPython team recommends the new pyreadline for Windows use, " - #print "It's superior especially with non-US keyboard layouts." - #print "Try installing it with 'easy_install pyreadline (ctypes is required) or" - #print "svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk pyreadline" - #print "Trying 'old' windows readline." - #print "Using 'old' readline, you might want to try pyreadline:" - #print "http://projects.scipy.org/ipython/ipython/wiki/PyReadline/Intro" - try: - from readline import * - import readline as _rl - have_readline = True - except ImportError: - pass - - if have_readline: - try: - _outputfile=_rl.GetOutputFile() - except NameError: - print "Failed GetOutputFile" - have_readline = False - -else: - try: - from readline import * - have_readline = True - except ImportError: - pass +# -*- coding: utf-8 -*- +""" Imports and provides the "correct" version of readline for the platform. + +Readline is used throughout IPython as "import IPython.rlineimpl as readline. + +In addition to normal readline stuff, this module provides have_readline boolean +and _outputfile variable used in genutils. + +$Id: Magic.py 1096 2006-01-28 20:08:02Z vivainio $""" + + +import sys + +have_readline = False + +if sys.platform == 'win32': + try: + import pyreadline.rlmain + #add config for inputrcpath here: + #pyreadline.rlmain.config_path="c:/python/test_config.ini" + from readline import * + #print "Using the new pyreadline (thanks for participating in the testing!)" + + have_readline = True + + import readline as _rl + except ImportError: + #print "IPython team recommends the new pyreadline for Windows use, " + #print "It's superior especially with non-US keyboard layouts." + #print "Try installing it with 'easy_install pyreadline (ctypes is required) or" + #print "svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk pyreadline" + #print "Trying 'old' windows readline." + #print "Using 'old' readline, you might want to try pyreadline:" + #print "http://projects.scipy.org/ipython/ipython/wiki/PyReadline/Intro" + try: + from readline import * + import readline as _rl + have_readline = True + except ImportError: + pass + + if have_readline: + try: + _outputfile=_rl.GetOutputFile() + except NameError: + print "Failed GetOutputFile" + have_readline = False + +else: + try: + from readline import * + have_readline = True + except ImportError: + pass diff --git a/IPython/strdispatch.py b/IPython/strdispatch.py index 156b21c..8516528 100755 --- a/IPython/strdispatch.py +++ b/IPython/strdispatch.py @@ -1,65 +1,65 @@ -from IPython.hooks import CommandChainDispatcher -import IPython.hooks - -import re - -class StrDispatch(object): - """ Dispatch (lookup) a set of strings / regexps for match """ - def __init__(self): - self.strs = {} - self.regexs = {} - def add_s(self, s, obj, priority= 0 ): - """ Adds a target 'string' for dispatching """ - - chain = self.strs.get(s, CommandChainDispatcher()) - chain.add(obj,priority) - self.strs[s] = chain - - def add_re(self, regex, obj, priority= 0 ): - """ Adds a target regexp for dispatching """ - - chain = self.regexs.get(regex, CommandChainDispatcher()) - chain.add(obj,priority) - self.regexs[regex] = chain - - def dispatch(self, key): - """ Get a seq of Commandchain objects that match key """ - if key in self.strs: - yield self.strs[key] - - for r, obj in self.regexs.items(): - if re.match(r, key): - yield obj - else: - #print "nomatch",key - pass - - - def __repr__(self): - return "" % (self.strs, self.regexs) - - def s_matches(self, key): - if key not in self.strs: - return - for el in self.strs[key]: - yield el[1] - - - def flat_matches(self, key): - """ Yield all 'value' targets, without priority """ - for val in self.dispatch(key): - for el in val: - yield el[1] # only value, no priority - return - - -def test(): - d = StrDispatch() - d.add_s('hei',34, priority = 4) - d.add_s('hei',123, priority = 2) - print list(d.dispatch('hei')) - d.add_re('h.i', 686) - print list(d.flat_matches('hei')) - -if __name__ == '__main__': +from IPython.hooks import CommandChainDispatcher +import IPython.hooks + +import re + +class StrDispatch(object): + """ Dispatch (lookup) a set of strings / regexps for match """ + def __init__(self): + self.strs = {} + self.regexs = {} + def add_s(self, s, obj, priority= 0 ): + """ Adds a target 'string' for dispatching """ + + chain = self.strs.get(s, CommandChainDispatcher()) + chain.add(obj,priority) + self.strs[s] = chain + + def add_re(self, regex, obj, priority= 0 ): + """ Adds a target regexp for dispatching """ + + chain = self.regexs.get(regex, CommandChainDispatcher()) + chain.add(obj,priority) + self.regexs[regex] = chain + + def dispatch(self, key): + """ Get a seq of Commandchain objects that match key """ + if key in self.strs: + yield self.strs[key] + + for r, obj in self.regexs.items(): + if re.match(r, key): + yield obj + else: + #print "nomatch",key + pass + + + def __repr__(self): + return "" % (self.strs, self.regexs) + + def s_matches(self, key): + if key not in self.strs: + return + for el in self.strs[key]: + yield el[1] + + + def flat_matches(self, key): + """ Yield all 'value' targets, without priority """ + for val in self.dispatch(key): + for el in val: + yield el[1] # only value, no priority + return + + +def test(): + d = StrDispatch() + d.add_s('hei',34, priority = 4) + d.add_s('hei',123, priority = 2) + print list(d.dispatch('hei')) + d.add_re('h.i', 686) + print list(d.flat_matches('hei')) + +if __name__ == '__main__': test() \ No newline at end of file diff --git a/IPython/upgrade_dir.py b/IPython/upgrade_dir.py index 5a83057..e45bdbf 100644 --- a/IPython/upgrade_dir.py +++ b/IPython/upgrade_dir.py @@ -1,94 +1,94 @@ -#!/usr/bin/env python -""" A script/util to upgrade all files in a directory - -This is rather conservative in its approach, only copying/overwriting -new and unedited files. - -To be used by "upgrade" feature. -""" -try: - from IPython.Extensions.path import path -except ImportError: - try: - from Extensions.path import path - except ImportError: - from path import path - -import md5,pickle - -def showdiff(old,new): - import difflib - d = difflib.Differ() - lines = d.compare(old.lines(),new.lines()) - realdiff = False - for l in lines: - print l, - if not realdiff and not l[0].isspace(): - realdiff = True - return realdiff - -def upgrade_dir(srcdir, tgtdir): - """ Copy over all files in srcdir to tgtdir w/ native line endings - - Creates .upgrade_report in tgtdir that stores md5sums of all files - to notice changed files b/w upgrades. - """ - - def pr(s): - print s - - def ignorable(p): - if p.lower().startswith('.svn') or p.startswith('ipythonrc'): - return True - return False - - - modded = [] - files = [path(srcdir).relpathto(p) for p in path(srcdir).walkfiles()] - #print files - rep = tgtdir / '.upgrade_report' - try: - rpt = pickle.load(rep.open()) - except: - rpt = {} - - for f in files: - if ignorable(f): - continue - src = srcdir / f - tgt = tgtdir / f - if not tgt.isfile(): - pr("Creating %s" % str(tgt)) - - tgt.write_text(src.text()) - rpt[str(tgt)] = md5.new(tgt.text()).hexdigest() - else: - cont = tgt.text() - sum = rpt.get(str(tgt), None) - #print sum - if sum and md5.new(cont).hexdigest() == sum: - pr("Unedited, installing new %s" % tgt) - tgt.write_text(src.text()) - rpt[str(tgt)] = md5.new(tgt.text()).hexdigest() - else: - pr(' == Modified, skipping %s, diffs below == ' % tgt) - #rpt[str(tgt)] = md5.new(tgt.bytes()).hexdigest() - real = showdiff(tgt,src) - pr('') # empty line - if not real: - pr("(Ok, it wasn't that different at all, upgrading checksum)") - rpt[str(tgt)] = md5.new(tgt.text()).hexdigest() - else: - modded.append(tgt) - - #print rpt - pickle.dump(rpt, rep.open('w')) - if modded: - print "\n\nDelete the following files manually (and rerun %upgrade)\nif you need a full upgrade:" - for m in modded: - print m - - -import sys -if __name__ == "__main__": - upgrade_dir(path(sys.argv[1]), path(sys.argv[2])) +#!/usr/bin/env python +""" A script/util to upgrade all files in a directory + +This is rather conservative in its approach, only copying/overwriting +new and unedited files. + +To be used by "upgrade" feature. +""" +try: + from IPython.Extensions.path import path +except ImportError: + try: + from Extensions.path import path + except ImportError: + from path import path + +import md5,pickle + +def showdiff(old,new): + import difflib + d = difflib.Differ() + lines = d.compare(old.lines(),new.lines()) + realdiff = False + for l in lines: + print l, + if not realdiff and not l[0].isspace(): + realdiff = True + return realdiff + +def upgrade_dir(srcdir, tgtdir): + """ Copy over all files in srcdir to tgtdir w/ native line endings + + Creates .upgrade_report in tgtdir that stores md5sums of all files + to notice changed files b/w upgrades. + """ + + def pr(s): + print s + + def ignorable(p): + if p.lower().startswith('.svn') or p.startswith('ipythonrc'): + return True + return False + + + modded = [] + files = [path(srcdir).relpathto(p) for p in path(srcdir).walkfiles()] + #print files + rep = tgtdir / '.upgrade_report' + try: + rpt = pickle.load(rep.open()) + except: + rpt = {} + + for f in files: + if ignorable(f): + continue + src = srcdir / f + tgt = tgtdir / f + if not tgt.isfile(): + pr("Creating %s" % str(tgt)) + + tgt.write_text(src.text()) + rpt[str(tgt)] = md5.new(tgt.text()).hexdigest() + else: + cont = tgt.text() + sum = rpt.get(str(tgt), None) + #print sum + if sum and md5.new(cont).hexdigest() == sum: + pr("Unedited, installing new %s" % tgt) + tgt.write_text(src.text()) + rpt[str(tgt)] = md5.new(tgt.text()).hexdigest() + else: + pr(' == Modified, skipping %s, diffs below == ' % tgt) + #rpt[str(tgt)] = md5.new(tgt.bytes()).hexdigest() + real = showdiff(tgt,src) + pr('') # empty line + if not real: + pr("(Ok, it wasn't that different at all, upgrading checksum)") + rpt[str(tgt)] = md5.new(tgt.text()).hexdigest() + else: + modded.append(tgt) + + #print rpt + pickle.dump(rpt, rep.open('w')) + if modded: + print "\n\nDelete the following files manually (and rerun %upgrade)\nif you need a full upgrade:" + for m in modded: + print m + + +import sys +if __name__ == "__main__": + upgrade_dir(path(sys.argv[1]), path(sys.argv[2])) diff --git a/IPython/usage.py b/IPython/usage.py index 7f4dd08..229f575 100644 --- a/IPython/usage.py +++ b/IPython/usage.py @@ -6,7 +6,7 @@ # the file COPYING, distributed as part of this software. #***************************************************************************** -# $Id: usage.py 1332 2006-05-30 01:41:28Z fperez $ +# $Id: usage.py 2010 2006-12-20 15:29:17Z vivainio $ from IPython import Release __author__ = '%s <%s>' % Release.authors['Fernando'] @@ -623,7 +623,8 @@ cd /usr/share : Obvious, also 'cd d:\home\_ipython' works History: _i, _ii, _iii : Previous, next previous, next next previous input -_ih[4], _ih[2:5] : Input history line 4, lines 2-4 +_i4, _ih[2:5] : Input history line 4, lines 2-4 +exec _i81 : Execute input history line #81 again _, __, ___ : previous, next previous, next next previous output _dh : Directory history _oh : Output history diff --git a/doc/ChangeLog b/doc/ChangeLog index d98bf30..4a1567b 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,32 @@ +2006-12-20 Ville Vainio + + * 0.7.3 is out - merge all from 0.7.3 branch to trunk + +2006-12-17 Ville Vainio + + * Extensions/jobctrl.py: Fixed &cmd arg arg... + to work properly on posix too + + * Release.py: Update revnum (version is still just 0.7.3). + +2006-12-15 Ville Vainio + + * scripts/ipython_win_post_install: create ipython.py in + prefix + "/scripts". + + * Release.py: Update version to 0.7.3. + +2006-12-14 Ville Vainio + + * scripts/ipython_win_post_install: Overwrite old shortcuts + if they already exist + + * Release.py: release 0.7.3rc2 + +2006-12-13 Ville Vainio + + * Branch and update Release.py for 0.7.3rc1 + 2006-12-13 Fernando Perez * IPython/Shell.py (IPShellWX): update for current WX naming diff --git a/doc/examples/seteditor.py b/doc/examples/seteditor.py index d9227cf..a2cde04 100755 --- a/doc/examples/seteditor.py +++ b/doc/examples/seteditor.py @@ -1,15 +1,15 @@ -import os - - -editor = r'q:/opt/np/notepad++.exe' - - -e = os.environ - -e['EDITOR'] = editor -e['VISUAL'] = editor - - - - - +import os + + +editor = r'q:/opt/np/notepad++.exe' + + +e = os.environ + +e['EDITOR'] = editor +e['VISUAL'] = editor + + + + + diff --git a/scripts/ipython_win_post_install.py b/scripts/ipython_win_post_install.py index efe573d..1b51bef 100755 --- a/scripts/ipython_win_post_install.py +++ b/scripts/ipython_win_post_install.py @@ -1,14 +1,13 @@ #!python """Windows-specific part of the installation""" -import os, sys +import os, sys, shutil -def create_shortcut_safe(target,description,link_file,*args,**kw): +def mkshortcut(target,description,link_file,*args,**kw): """make a shortcut if it doesn't exist, and register its creation""" - if not os.path.isfile(link_file): - create_shortcut(target, description, link_file,*args,**kw) - file_created(link_file) + create_shortcut(target, description, link_file,*args,**kw) + file_created(link_file) def install(): """Routine to be run by the win32 installer with the -install switch.""" @@ -49,21 +48,24 @@ def install(): # Create program shortcuts ... f = ip_dir + r'\IPython.lnk' a = prefix + r'\scripts\ipython' - create_shortcut_safe(python,'IPython',f,a) + mkshortcut(python,'IPython',f,a) f = ip_dir + r'\pysh.lnk' - a = prefix + r'\scripts\ipython -p pysh' - create_shortcut_safe(python,'pysh',f,a) + a = prefix + r'\scripts\ipython -p sh' + mkshortcut(python,'IPython command prompt mode',f,a) # Create documentation shortcuts ... t = prefix + r'\share\doc\ipython-%s\manual.pdf' % version f = ip_dir + r'\Manual in PDF.lnk' - create_shortcut_safe(t,r'IPython Manual - PDF-Format',f) + mkshortcut(t,r'IPython Manual - PDF-Format',f) t = prefix + r'\share\doc\ipython-%s\manual\manual.html' % version f = ip_dir + r'\Manual in HTML.lnk' - create_shortcut_safe(t,'IPython Manual - HTML-Format',f) + mkshortcut(t,'IPython Manual - HTML-Format',f) + # make ipython.py + shutil.copy(prefix + r'\scripts\ipython', prefix + r'\scripts\ipython.py') + def remove(): """Routine to be run by the win32 installer with the -remove switch.""" pass diff --git a/test/test_wildcard.py b/test/test_wildcard.py index 1c11551..1e0ee6c 100644 --- a/test/test_wildcard.py +++ b/test/test_wildcard.py @@ -1,100 +1,100 @@ -# -*- coding: UTF-8 -*- -import sys, unittest -sys.path.append ('..') - -from IPython import wildcard - -class obj_t(object): - pass - -root=obj_t() -l=["arna","abel","ABEL","active","bob","bark","abbot"] -q=["kate","loop","arne","vito","lucifer","koppel"] -for x in l: - o=obj_t() - setattr(root,x,o) - for y in q: - p=obj_t() - setattr(o,y,p) -root._apan=obj_t() -root._apan.a=10 -root._apan._a=20 -root._apan.__a=20 -root.__anka=obj_t() -root.__anka.a=10 -root.__anka._a=20 -root.__anka.__a=20 - -root._APAN=obj_t() -root._APAN.a=10 -root._APAN._a=20 -root._APAN.__a=20 -root.__ANKA=obj_t() -root.__ANKA.a=10 -root.__ANKA._a=20 -root.__ANKA.__a=20 - -class Tests (unittest.TestCase): - def test_case(self): - ns=root.__dict__ - tests=[ - ("a*", ["abbot","abel","active","arna",]), - ("?b*.?o*",["abbot.koppel","abbot.loop","abel.koppel","abel.loop",]), - ("_a*", []), - ("_*anka", ["__anka",]), - ("_*a*", ["__anka",]), - ] - for pat,res in tests: - res.sort() - a=wildcard.list_namespace(ns,"all",pat,ignore_case=False,show_all=False).keys() - a.sort() - self.assertEqual(a,res) - - def test_case_showall(self): - ns=root.__dict__ - tests=[ - ("a*", ["abbot","abel","active","arna",]), - ("?b*.?o*",["abbot.koppel","abbot.loop","abel.koppel","abel.loop",]), - ("_a*", ["_apan"]), - ("_*anka", ["__anka",]), - ("_*a*", ["__anka","_apan",]), - ] - for pat,res in tests: - res.sort() - a=wildcard.list_namespace(ns,"all",pat,ignore_case=False,show_all=True).keys() - a.sort() - self.assertEqual(a,res) - - - def test_nocase(self): - ns=root.__dict__ - tests=[ - ("a*", ["abbot","abel","ABEL","active","arna",]), - ("?b*.?o*",["abbot.koppel","abbot.loop","abel.koppel","abel.loop","ABEL.koppel","ABEL.loop",]), - ("_a*", []), - ("_*anka", ["__anka","__ANKA",]), - ("_*a*", ["__anka","__ANKA",]), - ] - for pat,res in tests: - res.sort() - a=wildcard.list_namespace(ns,"all",pat,ignore_case=True,show_all=False).keys() - a.sort() - self.assertEqual(a,res) - - def test_nocase_showall(self): - ns=root.__dict__ - tests=[ - ("a*", ["abbot","abel","ABEL","active","arna",]), - ("?b*.?o*",["abbot.koppel","abbot.loop","abel.koppel","abel.loop","ABEL.koppel","ABEL.loop",]), - ("_a*", ["_apan","_APAN"]), - ("_*anka", ["__anka","__ANKA",]), - ("_*a*", ["__anka","__ANKA","_apan","_APAN"]), - ] - for pat,res in tests: - res.sort() - a=wildcard.list_namespace(ns,"all",pat,ignore_case=True,show_all=True).keys() - a.sort() - self.assertEqual(a,res) - -if __name__ == '__main__': +# -*- coding: UTF-8 -*- +import sys, unittest +sys.path.append ('..') + +from IPython import wildcard + +class obj_t(object): + pass + +root=obj_t() +l=["arna","abel","ABEL","active","bob","bark","abbot"] +q=["kate","loop","arne","vito","lucifer","koppel"] +for x in l: + o=obj_t() + setattr(root,x,o) + for y in q: + p=obj_t() + setattr(o,y,p) +root._apan=obj_t() +root._apan.a=10 +root._apan._a=20 +root._apan.__a=20 +root.__anka=obj_t() +root.__anka.a=10 +root.__anka._a=20 +root.__anka.__a=20 + +root._APAN=obj_t() +root._APAN.a=10 +root._APAN._a=20 +root._APAN.__a=20 +root.__ANKA=obj_t() +root.__ANKA.a=10 +root.__ANKA._a=20 +root.__ANKA.__a=20 + +class Tests (unittest.TestCase): + def test_case(self): + ns=root.__dict__ + tests=[ + ("a*", ["abbot","abel","active","arna",]), + ("?b*.?o*",["abbot.koppel","abbot.loop","abel.koppel","abel.loop",]), + ("_a*", []), + ("_*anka", ["__anka",]), + ("_*a*", ["__anka",]), + ] + for pat,res in tests: + res.sort() + a=wildcard.list_namespace(ns,"all",pat,ignore_case=False,show_all=False).keys() + a.sort() + self.assertEqual(a,res) + + def test_case_showall(self): + ns=root.__dict__ + tests=[ + ("a*", ["abbot","abel","active","arna",]), + ("?b*.?o*",["abbot.koppel","abbot.loop","abel.koppel","abel.loop",]), + ("_a*", ["_apan"]), + ("_*anka", ["__anka",]), + ("_*a*", ["__anka","_apan",]), + ] + for pat,res in tests: + res.sort() + a=wildcard.list_namespace(ns,"all",pat,ignore_case=False,show_all=True).keys() + a.sort() + self.assertEqual(a,res) + + + def test_nocase(self): + ns=root.__dict__ + tests=[ + ("a*", ["abbot","abel","ABEL","active","arna",]), + ("?b*.?o*",["abbot.koppel","abbot.loop","abel.koppel","abel.loop","ABEL.koppel","ABEL.loop",]), + ("_a*", []), + ("_*anka", ["__anka","__ANKA",]), + ("_*a*", ["__anka","__ANKA",]), + ] + for pat,res in tests: + res.sort() + a=wildcard.list_namespace(ns,"all",pat,ignore_case=True,show_all=False).keys() + a.sort() + self.assertEqual(a,res) + + def test_nocase_showall(self): + ns=root.__dict__ + tests=[ + ("a*", ["abbot","abel","ABEL","active","arna",]), + ("?b*.?o*",["abbot.koppel","abbot.loop","abel.koppel","abel.loop","ABEL.koppel","ABEL.loop",]), + ("_a*", ["_apan","_APAN"]), + ("_*anka", ["__anka","__ANKA",]), + ("_*a*", ["__anka","__ANKA","_apan","_APAN"]), + ] + for pat,res in tests: + res.sort() + a=wildcard.list_namespace(ns,"all",pat,ignore_case=True,show_all=True).keys() + a.sort() + self.assertEqual(a,res) + +if __name__ == '__main__': unittest.main() \ No newline at end of file diff --git a/tools/check_sources.py b/tools/check_sources.py index 3acd2bc..bbc0046 100755 --- a/tools/check_sources.py +++ b/tools/check_sources.py @@ -1,15 +1,15 @@ -from path import path -fs = path('..').walkfiles('*.py') - -for f in fs: - errs = '' - cont = f.bytes() - if '\t' in cont: - errs+='t' - - if '\r' in cont: - errs+='r' - - if errs: - print "%3s" % errs, f +from path import path +fs = path('..').walkfiles('*.py') + +for f in fs: + errs = '' + cont = f.bytes() + if '\t' in cont: + errs+='t' + + if '\r' in cont: + errs+='r' + + if errs: + print "%3s" % errs, f \ No newline at end of file diff --git a/tools/make_tarball.py b/tools/make_tarball.py index c5ea64a..80bd309 100644 --- a/tools/make_tarball.py +++ b/tools/make_tarball.py @@ -1,6 +1,6 @@ import os,sys,shutil -repo = "http://ipython.scipy.org/svn/ipython/ipython/trunk" +repo = "http://ipython.scipy.org/svn/ipython/ipython/branches/0.7.3" basename = 'ipython' workdir = './mkdist' diff --git a/tools/update_revnum.py b/tools/update_revnum.py index fd37a90..9567c1f 100755 --- a/tools/update_revnum.py +++ b/tools/update_revnum.py @@ -1,13 +1,13 @@ -""" Change the revision number in Release.py """ - -import os -import re - -rev = os.popen('svnversion ..').read().strip() - -print "current rev is",rev -assert ':' not in rev - -rfile = open('../IPython/Release.py').read() -newcont = re.sub(r'revision\s*=.*', "revision = '%s'" % rev, rfile) -open('../IPython/Release.py','w').write(newcont) +""" Change the revision number in Release.py """ + +import os +import re + +rev = os.popen('svnversion ..').read().strip() + +print "current rev is",rev +assert ':' not in rev + +rfile = open('../IPython/Release.py').read() +newcont = re.sub(r'revision\s*=.*', "revision = '%s'" % rev, rfile) +open('../IPython/Release.py','w').write(newcont)