+++ /dev/null
-"""distutils.command.install_scripts\r
-\r
-Implements the Distutils 'install_scripts' command, for installing\r
-Python scripts."""\r
-\r
-# contributed by Bastian Kleineidam\r
-\r
-__revision__ = "$Id$"\r
-\r
-import os\r
-from distutils.core import Command\r
-from distutils import log\r
-from stat import ST_MODE\r
-\r
-class install_scripts (Command):\r
-\r
- description = "install scripts (Python or otherwise)"\r
-\r
- user_options = [\r
- ('install-dir=', 'd', "directory to install scripts to"),\r
- ('build-dir=','b', "build directory (where to install from)"),\r
- ('force', 'f', "force installation (overwrite existing files)"),\r
- ('skip-build', None, "skip the build steps"),\r
- ]\r
-\r
- boolean_options = ['force', 'skip-build']\r
-\r
-\r
- def initialize_options (self):\r
- self.install_dir = None\r
- self.force = 0\r
- self.build_dir = None\r
- self.skip_build = None\r
-\r
- def finalize_options (self):\r
- self.set_undefined_options('build', ('build_scripts', 'build_dir'))\r
- self.set_undefined_options('install',\r
- ('install_scripts', 'install_dir'),\r
- ('force', 'force'),\r
- ('skip_build', 'skip_build'),\r
- )\r
-\r
- def run (self):\r
- if not self.skip_build:\r
- self.run_command('build_scripts')\r
- self.outfiles = self.copy_tree(self.build_dir, self.install_dir)\r
- if os.name == 'posix':\r
- # Set the executable bits (owner, group, and world) on\r
- # all the scripts we just installed.\r
- for file in self.get_outputs():\r
- if self.dry_run:\r
- log.info("changing mode of %s", file)\r
- else:\r
- mode = ((os.stat(file)[ST_MODE]) | 0555) & 07777\r
- log.info("changing mode of %s to %o", file, mode)\r
- os.chmod(file, mode)\r
-\r
- def get_inputs (self):\r
- return self.distribution.scripts or []\r
-\r
- def get_outputs(self):\r
- return self.outfiles or []\r
-\r
-# class install_scripts\r