1
"""distutils.command.install_scripts
3
Implements the Distutils 'install_scripts' command, for installing
6
# contributed by Bastian Kleineidam
8
# This module should be kept compatible with Python 2.1.
10
__revision__ = "$Id: install_scripts.py,v 1.16 2004/11/10 22:23:15 loewis Exp $"
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)"
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
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'),
42
('skip_build', 'skip_build'),
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():
54
log.info("changing mode of %s", file)
56
mode = ((os.stat(file)[ST_MODE]) | 0555) & 07777
57
log.info("changing mode of %s to %o", 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