Greg Ward | 13ae1c8 | 1999-03-22 14:55:25 +0000 | [diff] [blame] | 1 | # created 1999/03/13, Greg Ward |
| 2 | |
| 3 | __rcsid__ = "$Id$" |
| 4 | |
| 5 | import sys |
| 6 | from distutils.core import Command |
| 7 | from distutils.util import copy_tree |
| 8 | |
| 9 | class InstallPy (Command): |
| 10 | |
| 11 | options = [('dir=', 'd', "directory to install to"), |
| 12 | ('build-dir=' 'b', "build directory (where to install from)")] |
| 13 | |
| 14 | def set_default_options (self): |
| 15 | # let the 'install' command dictate our installation directory |
| 16 | self.dir = None |
| 17 | self.build_dir = None |
| 18 | |
| 19 | def set_final_options (self): |
| 20 | # If we don't have a 'dir' value, we'll have to ask the 'install' |
| 21 | # command for one. (This usually means the user ran 'install_py' |
| 22 | # directly, rather than going through 'install' -- so in reality, |
| 23 | # 'find_command_obj()' will create an 'install' command object, |
| 24 | # which we then query. |
| 25 | |
| 26 | self.set_undefined_options ('install', |
| 27 | ('build_lib', 'build_dir'), |
| 28 | ('install_site_lib', 'dir')) |
| 29 | |
| 30 | def run (self): |
| 31 | |
| 32 | self.set_final_options () |
| 33 | |
| 34 | # Dump entire contents of the build directory to the installation |
| 35 | # directory (that's the beauty of having a build directory!) |
Greg Ward | 4070f50 | 1999-04-04 02:46:29 +0000 | [diff] [blame] | 36 | self.copy_tree (self.build_dir, self.dir) |
Greg Ward | 13ae1c8 | 1999-03-22 14:55:25 +0000 | [diff] [blame] | 37 | |
| 38 | # run () |
| 39 | |
| 40 | # class InstallPy |