2 from distutils
.core
import setup
3 from distutils
.command
.build_py
import build_py
4 from distutils
.command
.install_lib
import install_lib
8 pos
= sys
.argv
.index("--check-tkinter")
16 print >>sys
.stderr
, "Cannot install IDLE without _tkinter"
20 package_dir
= os
.path
.join(os
.environ
["SRCDIR"], "Tools", "idle")
24 # name of idle package
27 # the normal build_py would not incorporate the .txt files
28 txt_files
= ['config-unix.txt','config-win.txt','config.txt', 'help.txt']
29 Icons
= glob
.glob1(os
.path
.join(package_dir
,"Icons"),"*.gif")
30 class idle_build_py(build_py
):
31 def get_plain_outfile(self
, build_dir
, package
, file):
32 # like get_module_outfile, but does not append .py
33 outfile_path
= [build_dir
] + list(package
) + [file]
34 return apply(os
.path
.join
, outfile_path
)
37 # Copies all .py files, then also copies the txt and gif files
39 assert self
.packages
== [idlelib
]
40 for name
in txt_files
:
41 outfile
= self
.get_plain_outfile(self
.build_lib
, [idlelib
], name
)
42 dir = os
.path
.dirname(outfile
)
44 self
.copy_file(os
.path
.join(package_dir
, name
), outfile
,
47 outfile
= self
.get_plain_outfile(self
.build_lib
,
48 [idlelib
,"Icons"], name
)
49 dir = os
.path
.dirname(outfile
)
51 self
.copy_file(os
.path
.join(package_dir
, "Icons", name
),
52 outfile
, preserve_mode
= 0)
54 def get_source_files(self
):
55 # returns the .py files, the .txt files, and the icons
56 icons
= [os
.path
.join(package_dir
, "Icons",name
) for name
in Icons
]
57 txts
= [os
.path
.join(package_dir
, name
) for name
in txt_files
]
58 return build_py
.get_source_files(self
)+txt_files
+icons
60 def get_outputs(self
, include_bytecode
=1):
61 # returns the built files
62 outputs
= build_py
.get_outputs(self
, include_bytecode
)
63 if not include_bytecode
:
65 for name
in txt_files
:
66 filename
= self
.get_plain_outfile(self
.build_lib
,
68 outputs
.append(filename
)
70 filename
= self
.get_plain_outfile(self
.build_lib
,
71 [idlelib
,"Icons"], name
)
72 outputs
.append(filename
)
75 # Arghhh. install_lib thinks that all files returned from build_py's
76 # get_outputs are bytecode files
77 class idle_install_lib(install_lib
):
78 def _bytecode_filenames(self
, files
):
79 files
= [n
for n
in files
if n
.endswith('.py')]
80 return install_lib
._bytecode
_filenames
(self
,files
)
84 version
= idlever
.IDLE_VERSION
,
85 description
= "IDLE, the Python IDE",
86 author
= "Guido van Rossum",
87 author_email
= "guido@python.org",
90 """IDLE is a Tkinter based IDE for Python. It is written in 100% pure
91 Python and works both on Windows and Unix. It features a multi-window
92 text editor with multiple undo, Python colorizing, and many other things,
93 as well as a Python shell window and a debugger.""",
95 cmdclass
= {'build_py':idle_build_py
,
96 'install_lib':idle_install_lib
},
97 package_dir
= {idlelib
: package_dir
},
99 scripts
= [os
.path
.join(package_dir
, 'idle')]