[Idle-dev] CVS: idle PyShell.py,1.6,1.7 idle,1.2,1.3 idles,1.1,NONE
Kurt B. Kaiser
kbk@users.sourceforge.net
Mon, 16 Jul 2001 21:59:03 -0700
Update of /cvsroot/idlefork/idle
In directory usw-pr-cvs1:/tmp/cvs-serv11350
Modified Files:
PyShell.py idle
Removed Files:
idles
Log Message:
Implement idle command interface as suggested by GvR [idle-dev] 16 July
****************
PyShell: Added functionality:
usage: idle.py [-c command] [-d] [-i] [-r script] [-s] [-t title] [arg] ...
idle file(s) (without options) edit the file(s)
-c cmd run the command in a shell
-d enable the debugger
-i open an interactive shell
-i file(s) open a shell and also an editor window for each file
-r script run a file as a script in a shell
-s run $IDLESTARTUP or $PYTHONSTARTUP before anything else
-t title set title of shell window
Remaining arguments are applied to the command (-c) or script (-r).
******************
idles: Removed the idles script, not needed
******************
idle: Removed the IdleConf references, not required anymore
Index: PyShell.py
===================================================================
RCS file: /cvsroot/idlefork/idle/PyShell.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** PyShell.py 2001/07/16 05:25:12 1.6
--- PyShell.py 2001/07/17 04:59:01 1.7
***************
*** 710,724 ****
usage_msg = """\
! usage: idle.py [-c command] [-d] [-e] [-s] [-t title] [arg] ...
! -c command run this command
! -d enable debugger
! -e edit mode; arguments are files to be edited
! -s run $IDLESTARTUP or $PYTHONSTARTUP before anything else
! -t title set title of shell window
!
! When neither -c nor -e is used, and there are arguments, and the first
! argument is not '-', the first argument is run as a script. Remaining
! arguments are arguments to the script or to the command run by -c.
"""
--- 710,726 ----
usage_msg = """\
! usage: idle.py [-c command] [-d] [-i] [-r script] [-s] [-t title] [arg] ...
! idle file(s) (without options) edit the file(s)
!
! -c cmd run the command in a shell
! -d enable the debugger
! -i open an interactive shell
! -i file(s) open a shell and also an editor window for each file
! -r script run a file as a script in a shell
! -s run $IDLESTARTUP or $PYTHONSTARTUP before anything else
! -t title set title of shell window
!
! Remaining arguments are applied to the command (-c) or script (-r).
"""
***************
*** 782,789 ****
edit = 0
debug = 0
startup = 0
try:
! opts, args = getopt.getopt(argv, "c:deist:")
except getopt.error, msg:
sys.stderr.write("Error: %s\n" % str(msg))
--- 784,793 ----
edit = 0
debug = 0
+ interactive = 0
+ script = None
startup = 0
try:
! opts, args = getopt.getopt(argv, "c:dir:st:")
except getopt.error, msg:
sys.stderr.write("Error: %s\n" % str(msg))
***************
*** 792,802 ****
for o, a in opts:
! noshell = 0
if o == '-c':
cmd = a
if o == '-d':
debug = 1
! if o == '-e':
! edit = 1
if o == '-s':
startup = 1
--- 796,808 ----
for o, a in opts:
! noshell = 0 # There are options, bring up a shell
if o == '-c':
cmd = a
if o == '-d':
debug = 1
! if o == '-i':
! interactive = 1
! if o == '-r':
! script = a
if o == '-s':
startup = 1
***************
*** 805,808 ****
--- 811,815 ----
if noshell: edit=1
+ if interactive and args and args[0] != "-": edit = 1
for i in range(len(sys.path)):
***************
*** 861,867 ****
if cmd:
interp.execsource(cmd)
! elif not edit and args and args[0] != "-":
! interp.execfile(args[0])
!
shell.begin()
--- 868,876 ----
if cmd:
interp.execsource(cmd)
! elif script:
! if os.path.isfile(script):
! interp.execfile(script)
! else:
! print "No script file: ", script
shell.begin()
Index: idle
===================================================================
RCS file: /cvsroot/idlefork/idle/idle,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** idle 2001/07/04 03:15:10 1.2
--- idle 2001/07/17 04:59:01 1.3
***************
*** 1,12 ****
#! /usr/bin/env python
! import os
! import sys
! from idlelib import IdleConf
!
! idle_dir = os.path.dirname(IdleConf.__file__)
! IdleConf.load(idle_dir)
!
! # defer importing Pyshell until IdleConf is loaded
! from idlelib import PyShell
PyShell.main()
--- 1,4 ----
#! /usr/bin/env python
! import PyShell
PyShell.main()
--- idles DELETED ---