[Idle-dev] CVS: idle PyShell.py,1.47,1.48 idle,1.6,1.7 idle.py,1.4,1.5 idle.pyw,1.3,1.4 setup.py,1.10,1.11

Kurt B. Kaiser kbk@users.sourceforge.net
Mon, 23 Dec 2002 22:36:21 -0800


Update of /cvsroot/idlefork/idle
In directory sc8-pr-cvs1:/tmp/cvs-serv18403

Modified Files:
	PyShell.py idle idle.py idle.pyw setup.py 
Log Message:
M PyShell.py
M idle
M idle.py
M idle.pyw
M setup.py

Switch back to installing IDLE as a package.  The IDLE GUI and the
subprocess will both attempt to start up via the package mechanism, but if
IDLE is not yet installed it is possible to run by calling python idle.py
in the IDLE source directory, or to add the source directory to sys.path.

One advantage of doing it this way is IDLE stays off sys.path.

Developed in collaboration with Tony Lownds.


Index: PyShell.py
===================================================================
RCS file: /cvsroot/idlefork/idle/PyShell.py,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -r1.47 -r1.48
*** PyShell.py	24 Dec 2002 03:33:12 -0000	1.47
--- PyShell.py	24 Dec 2002 06:36:19 -0000	1.48
***************
*** 320,326 ****
              return [sys.executable, '-p', str(self.port)]
          else:
!             w = ['-W' + s for s in sys.warnoptions]        
!             return [sys.executable] + w \
!                  + ["-c", "__import__('run').main()", str(self.port)]
  
      def start_subprocess(self):
--- 320,332 ----
              return [sys.executable, '-p', str(self.port)]
          else:
!             w = ['-W' + s for s in sys.warnoptions]
!             # Maybe IDLE is installed and is being accessed via sys.path,
!             # or maybe it's not installed and the idle.py script is being
!             # run from the IDLE source directory.
!             if __name__ == 'idlelib.PyShell':
!                 command = "__import__('idlelib.run').run.main()"
!             else:
!                 command = "__import__('run').main()"
!             return [sys.executable] + w + ["-c", command, str(self.port)]
  
      def start_subprocess(self):

Index: idle
===================================================================
RCS file: /cvsroot/idlefork/idle/idle,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** idle	23 Dec 2002 18:12:41 -0000	1.6
--- idle	24 Dec 2002 06:36:19 -0000	1.7
***************
*** 1,4 ****
  #! /usr/bin/env python
  
! import PyShell
! PyShell.main()
--- 1,9 ----
  #! /usr/bin/env python
  
! try:
!     import idlelib.PyShell
!     idlelib.PyShell.main()
! except:
!     # IDLE is not installed, but maybe PyShell is on sys.path:
!     import PyShell
!     PyShell.main()

Index: idle.py
===================================================================
RCS file: /cvsroot/idlefork/idle/idle.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** idle.py	14 Jul 2001 05:21:37 -0000	1.4
--- idle.py	24 Dec 2002 06:36:19 -0000	1.5
***************
*** 1,4 ****
  #! /usr/bin/env python
  
! import PyShell
! PyShell.main()
--- 1,9 ----
  #! /usr/bin/env python
  
! try:
!     import idlelib.PyShell
!     idlelib.PyShell.main()
! except:
!     # IDLE is not installed, but maybe PyShell is on sys.path:
!     import PyShell
!     PyShell.main()

Index: idle.pyw
===================================================================
RCS file: /cvsroot/idlefork/idle/idle.pyw,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** idle.pyw	19 Sep 2002 19:54:55 -0000	1.3
--- idle.pyw	24 Dec 2002 06:36:19 -0000	1.4
***************
*** 1,4 ****
  #! /usr/bin/env python
  
! import PyShell
! PyShell.main()
--- 1,9 ----
  #! /usr/bin/env python
  
! try:
!     import idlelib.PyShell
!     idlelib.PyShell.main()
! except:
!     # IDLE is not installed, but maybe PyShell is on sys.path:
!     import PyShell
!     PyShell.main()

Index: setup.py
===================================================================
RCS file: /cvsroot/idlefork/idle/setup.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** setup.py	23 Dec 2002 03:31:49 -0000	1.10
--- setup.py	24 Dec 2002 06:36:19 -0000	1.11
***************
*** 47,51 ****
          build_py.run(self)
          for name in txt_files:
!             outfile = self.get_plain_outfile(self.build_lib, [], name)
              dir = os.path.dirname(outfile)
              self.mkpath(dir)
--- 47,51 ----
          build_py.run(self)
          for name in txt_files:
!             outfile = self.get_plain_outfile(self.build_lib, [pkgname], name)
              dir = os.path.dirname(outfile)
              self.mkpath(dir)
***************
*** 54,58 ****
          for name in Icons:
              outfile = self.get_plain_outfile(self.build_lib,
!                                              ["Icons"], name)
              dir = os.path.dirname(outfile)
              self.mkpath(dir)
--- 54,58 ----
          for name in Icons:
              outfile = self.get_plain_outfile(self.build_lib,
!                                              [pkgname, "Icons"], name)
              dir = os.path.dirname(outfile)
              self.mkpath(dir)
***************
*** 72,80 ****
              return outputs
          for name in txt_files:
!             filename = self.get_plain_outfile(self.build_lib, [], name)
              outputs.append(filename)
          for name in Icons:
              filename = self.get_plain_outfile(self.build_lib,
!                                               ["Icons"], name)
              outputs.append(filename)
          return outputs
--- 72,80 ----
              return outputs
          for name in txt_files:
!             filename = self.get_plain_outfile(self.build_lib, [pkgname], name)
              outputs.append(filename)
          for name in Icons:
              filename = self.get_plain_outfile(self.build_lib,
!                                               [pkgname, "Icons"], name)
              outputs.append(filename)
          return outputs
***************
*** 112,117 ****
                    'install_lib':IDLE_Installer},
        package_dir = {pkgname: pkg_dir},
!       extra_path = pkgname,
!       py_modules = [f.split('.')[0] for f in glob.glob("*.py")],
        scripts = [os.path.join(pkg_dir, idle_name)]
        )
--- 112,116 ----
                    'install_lib':IDLE_Installer},
        package_dir = {pkgname: pkg_dir},
!       packages = [pkgname],
        scripts = [os.path.join(pkg_dir, idle_name)]
        )