Rewrite to use test_support's fine fcmp instead -- I didn't know that
[python/dscho.git] / Lib / idlelib / setup.py
blobe6835120959ef520b4e99faf7d7aeee2a24f9bc6
1 import os,glob
2 from distutils.core import setup
3 from distutils.command.build_py import build_py
4 from distutils.command.install_lib import install_lib
5 import idlever
7 # name of idle package
8 idlelib = "idlelib"
10 # the normal build_py would not incorporate the .txt files
11 txt_files = ['config-unix.txt','config-win.txt','config.txt', 'help.txt']
12 Icons = glob.glob1("Icons","*.gif")
13 class 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)
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)
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
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
56 # Arghhh. install_lib thinks that all files returned from build_py's
57 # get_outputs are bytecode files
59 class 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)
64 setup(name="IDLE",
65 version = idlever.IDLE_VERSION,
66 description = "IDLE Fork, the Forked Python IDE",
67 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
72 Python and works both on Windows and Unix. It features a multi-window
73 text editor with multiple undo, Python colorizing, and many other things,
74 as well as a Python shell window and a debugger.
76 IDLE Fork is a separate line of development which was initiated by D. Scherer
77 at CMU as part of Visual Python. It features execution in a separate
78 process, with a fresh environment for each run. For further details,
79 refer to idlefork.sourceforge.net.""",
81 cmdclass = {'build_py':idle_build_py,
82 'install_lib':idle_install_lib},
83 package_dir = {idlelib:'.'},
84 packages = [idlelib],
85 scripts = ['idle']