2002-11-30 17:54:17 +00:00
|
|
|
import os, glob, sys
|
2003-03-10 20:41:07 +00:00
|
|
|
from distutils.core import setup, Extension
|
2001-06-25 07:23:57 +00:00
|
|
|
from distutils.command.build_py import build_py
|
|
|
|
from distutils.command.install_lib import install_lib
|
|
|
|
import idlever
|
|
|
|
|
2002-12-20 22:40:30 +00:00
|
|
|
idle_name = "idle"
|
|
|
|
|
2002-12-23 03:31:49 +00:00
|
|
|
# Name of 'package' to be installed in site-packages:
|
|
|
|
pkgname = idle_name + "lib"
|
|
|
|
|
2002-11-30 17:54:17 +00:00
|
|
|
try:
|
|
|
|
pos = sys.argv.index("--check-tkinter")
|
|
|
|
except ValueError:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
del sys.argv[pos]
|
|
|
|
try:
|
|
|
|
import _tkinter
|
|
|
|
except ImportError:
|
|
|
|
print >>sys.stderr, "Cannot install IDLE without _tkinter"
|
|
|
|
raise SystemExit
|
|
|
|
|
2003-01-21 04:42:50 +00:00
|
|
|
try:
|
|
|
|
pkg_dir = os.path.join(os.environ['SRCDIR'], 'Tools', idle_name)
|
|
|
|
except KeyError:
|
|
|
|
pkg_dir = "."
|
|
|
|
|
2002-12-23 03:31:49 +00:00
|
|
|
# the normal build_py would not incorporate anything but .py files
|
2003-01-02 20:33:26 +00:00
|
|
|
txt_files = ['extend.txt', 'help.txt', 'CREDITS.txt', 'HISTORY.txt',
|
|
|
|
'INSTALL.txt', 'LICENSE.txt', 'NEWS.txt', 'README.txt']
|
2002-12-20 22:40:30 +00:00
|
|
|
txt_files += ['config-extensions.def', 'config-highlight.def',
|
|
|
|
'config-keys.def', 'config-main.def']
|
2002-12-23 03:31:49 +00:00
|
|
|
txt_files += [idle_name + '.bat', idle_name + '.pyw']
|
2002-12-21 21:03:06 +00:00
|
|
|
|
2003-01-21 04:42:50 +00:00
|
|
|
Icons = glob.glob1(os.path.join(pkg_dir, "Icons"), "*.gif")
|
2002-12-21 21:03:06 +00:00
|
|
|
|
2002-12-20 22:40:30 +00:00
|
|
|
class IDLE_Builder(build_py):
|
2001-06-25 07:23:57 +00:00
|
|
|
def get_plain_outfile(self, build_dir, package, file):
|
|
|
|
# like get_module_outfile, but does not append .py
|
|
|
|
outfile_path = [build_dir] + list(package) + [file]
|
|
|
|
return apply(os.path.join, outfile_path)
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
# Copies all .py files, then also copies the txt and gif files
|
|
|
|
build_py.run(self)
|
|
|
|
for name in txt_files:
|
2002-12-24 06:36:19 +00:00
|
|
|
outfile = self.get_plain_outfile(self.build_lib, [pkgname], name)
|
2001-06-25 07:23:57 +00:00
|
|
|
dir = os.path.dirname(outfile)
|
|
|
|
self.mkpath(dir)
|
2002-12-23 03:31:49 +00:00
|
|
|
self.copy_file(os.path.join(pkg_dir, name), outfile,
|
2002-11-30 17:54:17 +00:00
|
|
|
preserve_mode = 0)
|
2001-06-25 07:23:57 +00:00
|
|
|
for name in Icons:
|
|
|
|
outfile = self.get_plain_outfile(self.build_lib,
|
2002-12-24 06:36:19 +00:00
|
|
|
[pkgname, "Icons"], name)
|
2001-06-25 07:23:57 +00:00
|
|
|
dir = os.path.dirname(outfile)
|
|
|
|
self.mkpath(dir)
|
2003-01-21 04:42:50 +00:00
|
|
|
self.copy_file(os.path.join(pkg_dir, "Icons", name),
|
2001-06-25 07:23:57 +00:00
|
|
|
outfile, preserve_mode = 0)
|
|
|
|
|
|
|
|
def get_source_files(self):
|
2002-12-20 22:40:30 +00:00
|
|
|
# returns the .py files, the .txt and .def files, and the icons
|
2002-12-23 03:31:49 +00:00
|
|
|
icons = [os.path.join(pkg_dir, "Icons",name) for name in Icons]
|
|
|
|
txts = [os.path.join(pkg_dir, name) for name in txt_files]
|
2002-12-20 22:40:30 +00:00
|
|
|
return build_py.get_source_files(self) + txt_files + icons
|
2001-06-25 07:23:57 +00:00
|
|
|
|
|
|
|
def get_outputs(self, include_bytecode=1):
|
|
|
|
# returns the built files
|
|
|
|
outputs = build_py.get_outputs(self, include_bytecode)
|
|
|
|
if not include_bytecode:
|
|
|
|
return outputs
|
|
|
|
for name in txt_files:
|
2002-12-24 06:36:19 +00:00
|
|
|
filename = self.get_plain_outfile(self.build_lib, [pkgname], name)
|
2001-06-25 07:23:57 +00:00
|
|
|
outputs.append(filename)
|
|
|
|
for name in Icons:
|
|
|
|
filename = self.get_plain_outfile(self.build_lib,
|
2002-12-24 06:36:19 +00:00
|
|
|
[pkgname, "Icons"], name)
|
2001-06-25 07:23:57 +00:00
|
|
|
outputs.append(filename)
|
|
|
|
return outputs
|
|
|
|
|
|
|
|
# Arghhh. install_lib thinks that all files returned from build_py's
|
|
|
|
# get_outputs are bytecode files
|
2001-07-17 05:12:42 +00:00
|
|
|
|
2002-12-20 22:40:30 +00:00
|
|
|
class IDLE_Installer(install_lib):
|
2001-06-25 07:23:57 +00:00
|
|
|
def _bytecode_filenames(self, files):
|
|
|
|
files = [n for n in files if n.endswith('.py')]
|
2002-12-20 22:40:30 +00:00
|
|
|
return install_lib._bytecode_filenames(self, files)
|
2001-06-25 07:23:57 +00:00
|
|
|
|
2002-12-20 22:40:30 +00:00
|
|
|
setup(name="IDLEfork",
|
2001-06-25 07:23:57 +00:00
|
|
|
version = idlever.IDLE_VERSION,
|
2002-12-20 22:40:30 +00:00
|
|
|
description = "IDLEfork, the Developmental Python IDE",
|
|
|
|
author = "Guido van Rossum et. al.",
|
|
|
|
author_email = "idle-dev@python.org",
|
2002-12-22 01:48:28 +00:00
|
|
|
license = "PSF: www.python.org",
|
2002-12-20 22:40:30 +00:00
|
|
|
url = "https://sourceforge.net/projects/idlefork/",
|
2001-06-25 07:23:57 +00:00
|
|
|
long_description =
|
2002-12-23 03:31:49 +00:00
|
|
|
"""IDLE is a Tkinter based IDE for Python. It is written in 100% pure
|
|
|
|
Python and works both on Windows and Unix. It features a multi-window
|
|
|
|
text editor with multiple undo, Python colorizing, and many other
|
|
|
|
things, as well as a Python shell window and a debugger.
|
|
|
|
|
|
|
|
IDLEfork is a separate line of development which was initiated by
|
2003-01-02 20:33:26 +00:00
|
|
|
David Scherer at CMU as part of VPython. It features execution in a
|
2002-12-23 03:31:49 +00:00
|
|
|
separate process which is newly initiated for each run. At version 0.9
|
|
|
|
the RPC was changed to incorporate code by GvR, which supports the
|
|
|
|
debugger. IDLEfork also incorporates a GUI configuration utilility.
|
|
|
|
For further details, refer to idlefork.sourceforge.net.
|
2002-12-20 22:40:30 +00:00
|
|
|
""",
|
2001-06-25 07:23:57 +00:00
|
|
|
|
2002-12-20 22:40:30 +00:00
|
|
|
cmdclass = {'build_py':IDLE_Builder,
|
|
|
|
'install_lib':IDLE_Installer},
|
2002-12-23 03:31:49 +00:00
|
|
|
package_dir = {pkgname: pkg_dir},
|
2002-12-24 06:36:19 +00:00
|
|
|
packages = [pkgname],
|
2003-03-10 20:41:07 +00:00
|
|
|
ext_modules = [Extension("interrupt", ["interruptmodule.c"])],
|
2002-12-23 03:31:49 +00:00
|
|
|
scripts = [os.path.join(pkg_dir, idle_name)]
|
2001-06-25 07:23:57 +00:00
|
|
|
)
|