blob: e6835120959ef520b4e99faf7d7aeee2a24f9bc6 [file] [log] [blame]
Steven M. Gavad7b6ed22001-06-25 07:23:57 +00001import os,glob
2from distutils.core import setup
3from distutils.command.build_py import build_py
4from distutils.command.install_lib import install_lib
5import idlever
6
7# name of idle package
8idlelib = "idlelib"
9
10# the normal build_py would not incorporate the .txt files
Kurt B. Kaiser3eb78602001-07-14 05:48:44 +000011txt_files = ['config-unix.txt','config-win.txt','config.txt', 'help.txt']
Steven M. Gavad7b6ed22001-06-25 07:23:57 +000012Icons = glob.glob1("Icons","*.gif")
13class idle_build_py(build_py):
14 def get_plain_outfile(self, build_dir, package, file):
15 # like get_module_outfile, but does not append .py
16 outfile_path = [build_dir] + list(package) + [file]
17 return apply(os.path.join, outfile_path)
18
19 def run(self):
20 # Copies all .py files, then also copies the txt and gif files
21 build_py.run(self)
22 assert self.packages == [idlelib]
23 for name in txt_files:
24 outfile = self.get_plain_outfile(self.build_lib, [idlelib], name)
25 dir = os.path.dirname(outfile)
26 self.mkpath(dir)
27 self.copy_file(name, outfile, preserve_mode = 0)
28 for name in Icons:
29 outfile = self.get_plain_outfile(self.build_lib,
30 [idlelib,"Icons"], name)
31 dir = os.path.dirname(outfile)
32 self.mkpath(dir)
33 self.copy_file(os.path.join("Icons",name),
34 outfile, preserve_mode = 0)
35
36 def get_source_files(self):
37 # returns the .py files, the .txt files, and the icons
38 icons = [os.path.join("Icons",name) for name in Icons]
39 return build_py.get_source_files(self)+txt_files+icons
40
41 def get_outputs(self, include_bytecode=1):
42 # returns the built files
43 outputs = build_py.get_outputs(self, include_bytecode)
44 if not include_bytecode:
45 return outputs
46 for name in txt_files:
47 filename = self.get_plain_outfile(self.build_lib,
48 [idlelib], name)
49 outputs.append(filename)
50 for name in Icons:
51 filename = self.get_plain_outfile(self.build_lib,
52 [idlelib,"Icons"], name)
53 outputs.append(filename)
54 return outputs
55
56# Arghhh. install_lib thinks that all files returned from build_py's
57# get_outputs are bytecode files
Kurt B. Kaiser59e07bd2001-07-17 05:12:42 +000058
Steven M. Gavad7b6ed22001-06-25 07:23:57 +000059class idle_install_lib(install_lib):
60 def _bytecode_filenames(self, files):
61 files = [n for n in files if n.endswith('.py')]
62 return install_lib._bytecode_filenames(self,files)
63
Steven M. Gavad7b6ed22001-06-25 07:23:57 +000064setup(name="IDLE",
65 version = idlever.IDLE_VERSION,
Kurt B. Kaiser59e07bd2001-07-17 05:12:42 +000066 description = "IDLE Fork, the Forked Python IDE",
Steven M. Gavad7b6ed22001-06-25 07:23:57 +000067 author = "Guido van Rossum",
68 author_email = "guido@python.org",
69 #url =
70 long_description =
71"""IDLE is a Tkinter based IDE for Python. It is written in 100% pure
72Python and works both on Windows and Unix. It features a multi-window
73text editor with multiple undo, Python colorizing, and many other things,
Kurt B. Kaiser59e07bd2001-07-17 05:12:42 +000074as well as a Python shell window and a debugger.
75
76IDLE Fork is a separate line of development which was initiated by D. Scherer
77at CMU as part of Visual Python. It features execution in a separate
78process, with a fresh environment for each run. For further details,
79refer to idlefork.sourceforge.net.""",
Steven M. Gavad7b6ed22001-06-25 07:23:57 +000080
81 cmdclass = {'build_py':idle_build_py,
82 'install_lib':idle_install_lib},
83 package_dir = {idlelib:'.'},
84 packages = [idlelib],
Kurt B. Kaiser59e07bd2001-07-17 05:12:42 +000085 scripts = ['idle']
Steven M. Gavad7b6ed22001-06-25 07:23:57 +000086 )