Move setting of ioready 'wait' earlier in call chain, to
[python/dscho.git] / Lib / distutils / command / install_scripts.py
blobabe10457b666e1ccb64907a421a7d8164e56761a
1 """distutils.command.install_scripts
3 Implements the Distutils 'install_scripts' command, for installing
4 Python scripts."""
6 # contributed by Bastian Kleineidam
8 # This module should be kept compatible with Python 1.5.2.
10 __revision__ = "$Id$"
12 import os
13 from distutils.core import Command
14 from distutils import log
15 from stat import ST_MODE
17 class install_scripts (Command):
19 description = "install scripts (Python or otherwise)"
21 user_options = [
22 ('install-dir=', 'd', "directory to install scripts to"),
23 ('build-dir=','b', "build directory (where to install from)"),
24 ('force', 'f', "force installation (overwrite existing files)"),
25 ('skip-build', None, "skip the build steps"),
28 boolean_options = ['force', 'skip-build']
31 def initialize_options (self):
32 self.install_dir = None
33 self.force = 0
34 self.build_dir = None
35 self.skip_build = None
37 def finalize_options (self):
38 self.set_undefined_options('build', ('build_scripts', 'build_dir'))
39 self.set_undefined_options('install',
40 ('install_scripts', 'install_dir'),
41 ('force', 'force'),
42 ('skip_build', 'skip_build'),
45 def run (self):
46 if not self.skip_build:
47 self.run_command('build_scripts')
48 self.outfiles = self.copy_tree(self.build_dir, self.install_dir)
49 if os.name == 'posix':
50 # Set the executable bits (owner, group, and world) on
51 # all the scripts we just installed.
52 for file in self.get_outputs():
53 if self.dry_run:
54 log.info("changing mode of %s", file)
55 else:
56 mode = ((os.stat(file)[ST_MODE]) | 0555) & 07777
57 log.info("changing mode of %s to %o", file, mode)
58 os.chmod(file, mode)
60 def get_inputs (self):
61 return self.distribution.scripts or []
63 def get_outputs(self):
64 return self.outfiles or []
66 # class install_scripts