Show More
@@ -1,7 +1,7 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """Magic functions for InteractiveShell. |
|
2 | """Magic functions for InteractiveShell. | |
3 |
|
3 | |||
4 |
$Id: Magic.py 11 |
|
4 | $Id: Magic.py 1140 2006-02-10 17:07:11Z vivainio $""" | |
5 |
|
5 | |||
6 | #***************************************************************************** |
|
6 | #***************************************************************************** | |
7 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and |
|
7 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and | |
@@ -2220,7 +2220,7 b' Defaulting color scheme to \'NoColor\'"""' | |||||
2220 | 'in alias definitions.') |
|
2220 | 'in alias definitions.') | |
2221 | else: # all looks OK |
|
2221 | else: # all looks OK | |
2222 | self.shell.alias_table[alias] = (nargs,cmd) |
|
2222 | self.shell.alias_table[alias] = (nargs,cmd) | |
2223 |
self.shell.alias_table_validate(verbose= |
|
2223 | self.shell.alias_table_validate(verbose=0) | |
2224 | # end magic_alias |
|
2224 | # end magic_alias | |
2225 |
|
2225 | |||
2226 | def magic_unalias(self, parameter_s = ''): |
|
2226 | def magic_unalias(self, parameter_s = ''): | |
@@ -2267,7 +2267,7 b' Defaulting color scheme to \'NoColor\'"""' | |||||
2267 |
|
2267 | |||
2268 | path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep)) |
|
2268 | path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep)) | |
2269 | alias_table = self.shell.alias_table |
|
2269 | alias_table = self.shell.alias_table | |
2270 |
|
2270 | syscmdlist = [] | ||
2271 | if os.name == 'posix': |
|
2271 | if os.name == 'posix': | |
2272 | isexec = lambda fname:os.path.isfile(fname) and \ |
|
2272 | isexec = lambda fname:os.path.isfile(fname) and \ | |
2273 | os.access(fname,os.X_OK) |
|
2273 | os.access(fname,os.X_OK) | |
@@ -2293,17 +2293,21 b' Defaulting color scheme to \'NoColor\'"""' | |||||
2293 | # where N is the number of positional arguments of the |
|
2293 | # where N is the number of positional arguments of the | |
2294 | # alias. |
|
2294 | # alias. | |
2295 | alias_table[ff] = (0,ff) |
|
2295 | alias_table[ff] = (0,ff) | |
|
2296 | syscmdlist.append(ff) | |||
2296 | else: |
|
2297 | else: | |
2297 | for pdir in path: |
|
2298 | for pdir in path: | |
2298 | os.chdir(pdir) |
|
2299 | os.chdir(pdir) | |
2299 | for ff in os.listdir(pdir): |
|
2300 | for ff in os.listdir(pdir): | |
2300 | if isexec(ff): |
|
2301 | if isexec(ff): | |
2301 | alias_table[execre.sub(r'\1',ff)] = (0,ff) |
|
2302 | alias_table[execre.sub(r'\1',ff)] = (0,ff) | |
|
2303 | syscmdlist.append(ff) | |||
2302 | # Make sure the alias table doesn't contain keywords or builtins |
|
2304 | # Make sure the alias table doesn't contain keywords or builtins | |
2303 | self.shell.alias_table_validate() |
|
2305 | self.shell.alias_table_validate() | |
2304 | # Call again init_auto_alias() so we get 'rm -i' and other |
|
2306 | # Call again init_auto_alias() so we get 'rm -i' and other | |
2305 | # modified aliases since %rehashx will probably clobber them |
|
2307 | # modified aliases since %rehashx will probably clobber them | |
2306 | self.shell.init_auto_alias() |
|
2308 | self.shell.init_auto_alias() | |
|
2309 | db = self.getapi().getdb() | |||
|
2310 | db['syscmdlist'] = syscmdlist | |||
2307 | finally: |
|
2311 | finally: | |
2308 | os.chdir(savedir) |
|
2312 | os.chdir(savedir) | |
2309 |
|
2313 |
@@ -6,7 +6,7 b' Requires Python 2.3 or newer.' | |||||
6 |
|
6 | |||
7 | This file contains all the classes and helper functions specific to IPython. |
|
7 | This file contains all the classes and helper functions specific to IPython. | |
8 |
|
8 | |||
9 |
$Id: iplib.py 11 |
|
9 | $Id: iplib.py 1140 2006-02-10 17:07:11Z vivainio $ | |
10 | """ |
|
10 | """ | |
11 |
|
11 | |||
12 | #***************************************************************************** |
|
12 | #***************************************************************************** | |
@@ -601,6 +601,19 b' class InteractiveShell(object,Magic):' | |||||
601 | self.init_auto_alias() |
|
601 | self.init_auto_alias() | |
602 | # end __init__ |
|
602 | # end __init__ | |
603 |
|
603 | |||
|
604 | def pre_config_initialization(self): | |||
|
605 | """Pre-configuration init method | |||
|
606 | ||||
|
607 | This is called before the configuration files are processed to | |||
|
608 | prepare the services the config files might need. | |||
|
609 | ||||
|
610 | self.rc already has reasonable default values at this point. | |||
|
611 | """ | |||
|
612 | rc = self.rc | |||
|
613 | ||||
|
614 | self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db") | |||
|
615 | ||||
|
616 | ||||
604 | def post_config_initialization(self): |
|
617 | def post_config_initialization(self): | |
605 | """Post configuration init method |
|
618 | """Post configuration init method | |
606 |
|
619 | |||
@@ -609,7 +622,6 b' class InteractiveShell(object,Magic):' | |||||
609 |
|
622 | |||
610 | rc = self.rc |
|
623 | rc = self.rc | |
611 |
|
624 | |||
612 | self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db") |
|
|||
613 | # Load readline proper |
|
625 | # Load readline proper | |
614 | if rc.readline: |
|
626 | if rc.readline: | |
615 | self.init_readline() |
|
627 | self.init_readline() |
@@ -6,7 +6,7 b' Requires Python 2.1 or better.' | |||||
6 |
|
6 | |||
7 | This file contains the main make_IPython() starter function. |
|
7 | This file contains the main make_IPython() starter function. | |
8 |
|
8 | |||
9 |
$Id: ipmaker.py 11 |
|
9 | $Id: ipmaker.py 1140 2006-02-10 17:07:11Z vivainio $""" | |
10 |
|
10 | |||
11 | #***************************************************************************** |
|
11 | #***************************************************************************** | |
12 | # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu> |
|
12 | # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu> | |
@@ -498,6 +498,7 b" object? -> Details about 'object'. ?object also works, ?? prints more." | |||||
498 | IP_rc.colors = 'NoColor' |
|
498 | IP_rc.colors = 'NoColor' | |
499 | IP_rc.xmode = 'Plain' |
|
499 | IP_rc.xmode = 'Plain' | |
500 |
|
500 | |||
|
501 | IP.pre_config_initialization() | |||
501 | # configure readline |
|
502 | # configure readline | |
502 | # Define the history file for saving commands in between sessions |
|
503 | # Define the history file for saving commands in between sessions | |
503 | if IP_rc.profile: |
|
504 | if IP_rc.profile: |
General Comments 0
You need to be logged in to leave comments.
Login now