[Idle-dev] Distutil-ized IDLE

Greg Ward gward@mems-exchange.org
Fri, 8 Sep 2000 10:14:26 -0400


On 08 September 2000, I said:
> I would be happy to write a setup script that makes it easy to install
> Tools/idle as a "third-party" module distribution, complete with a
> launch script, if there's interest.  Oh hell, maybe I'll do it
> anyways... just howl if you don't think I should check it in.

OK, as threatened, I've written a setup script for IDLE.  (Specifically,
the version in Tools/idle in the Python 1.6 and 2.0 source
distributions.)  This installs IDLE into a pacakge "idle", which means
that the imports in idle.py have to change.  Rather than change idle.py,
I wrote a new script just called "idle"; this would replace idle.py and
be installed in <prefix>/bin (on Unix -- I think scripts installed by
the Distutils go to <prefix>/Scripts on Windows, which was a largely
arbitrary choice).

Anyways, here's the setup script:

  #!/usr/bin/env python

  import os
  from distutils.core import setup
  from distutils.command.install_data import install_data

  class IDLE_install_data (install_data):
      def finalize_options (self):
          if self.install_dir is None:
              install_lib = self.get_finalized_command('install_lib')
              self.install_dir = os.path.join(install_lib.install_dir, "idle")

  setup(name = "IDLE",
        version = "0.6",
        author = "Guido van Rossum",
        author_email = "guido@python.org",
        cmdclass = {'install_data': IDLE_install_data},
        packages = ['idle'],
        package_dir = {'idle': ''},
        scripts = ['idle'],
        data_files = ['config.txt', 'config-unix.txt', 'config-win.txt'])

And the changes I suggest to make IDLE smoothly installable:
  * remove idle.py 
  * add this setup.py and idle (which is just idle.py with the imports
    changed)
  * add some instructions on how to install and run IDLE somewhere

I just checked the CVS repository for the IDLE fork, and don't see a
setup.py there either -- so presumably the forked IDLE could benefit
from this as well (hence the cc: idle-dev@python.org).

        Greg
-- 
Greg Ward - software developer                gward@mems-exchange.org
MEMS Exchange / CNRI                           voice: +1-703-262-5376
Reston, Virginia, USA                            fax: +1-703-262-5367