Steven M. Gava | d7b6ed2 | 2001-06-25 07:23:57 +0000 | [diff] [blame] | 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 |
| 6 | |
| 7 | # name of idle package |
| 8 | idlelib = "idlelib" |
| 9 | |
| 10 | # the normal build_py would not incorporate the .txt files |
Kurt B. Kaiser | 3eb7860 | 2001-07-14 05:48:44 +0000 | [diff] [blame] | 11 | txt_files = ['config-unix.txt','config-win.txt','config.txt', 'help.txt'] |
Steven M. Gava | d7b6ed2 | 2001-06-25 07:23:57 +0000 | [diff] [blame] | 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) |
| 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. Kaiser | 59e07bd | 2001-07-17 05:12:42 +0000 | [diff] [blame^] | 58 | |
Steven M. Gava | d7b6ed2 | 2001-06-25 07:23:57 +0000 | [diff] [blame] | 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) |
| 63 | |
Steven M. Gava | d7b6ed2 | 2001-06-25 07:23:57 +0000 | [diff] [blame] | 64 | setup(name="IDLE", |
| 65 | version = idlever.IDLE_VERSION, |
Kurt B. Kaiser | 59e07bd | 2001-07-17 05:12:42 +0000 | [diff] [blame^] | 66 | description = "IDLE Fork, the Forked Python IDE", |
Steven M. Gava | d7b6ed2 | 2001-06-25 07:23:57 +0000 | [diff] [blame] | 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, |
Kurt B. Kaiser | 59e07bd | 2001-07-17 05:12:42 +0000 | [diff] [blame^] | 74 | as well as a Python shell window and a debugger. |
| 75 | |
| 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.""", |
Steven M. Gava | d7b6ed2 | 2001-06-25 07:23:57 +0000 | [diff] [blame] | 80 | |
| 81 | cmdclass = {'build_py':idle_build_py, |
| 82 | 'install_lib':idle_install_lib}, |
| 83 | package_dir = {idlelib:'.'}, |
| 84 | packages = [idlelib], |
Kurt B. Kaiser | 59e07bd | 2001-07-17 05:12:42 +0000 | [diff] [blame^] | 85 | scripts = ['idle'] |
Steven M. Gava | d7b6ed2 | 2001-06-25 07:23:57 +0000 | [diff] [blame] | 86 | ) |