summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/cmd.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2000-05-12 00:52:23 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2000-05-12 00:52:23 (GMT)
commitb2e3bb3d6aaf4ef04211b932c64ef9cd5adc56bb (patch)
treee8d4e539fef4c83ccbf22ee1169a8e21cc25ddc9 /Lib/distutils/cmd.py
parentbb8c71d56370a97d2c9b5db0935475f1c99d422a (diff)
downloadcpython-b2e3bb3d6aaf4ef04211b932c64ef9cd5adc56bb.zip
cpython-b2e3bb3d6aaf4ef04211b932c64ef9cd5adc56bb.tar.gz
cpython-b2e3bb3d6aaf4ef04211b932c64ef9cd5adc56bb.tar.bz2
Patch from Bastien Kleineidam:
adds the 'install_data' and 'install_scripts' commands; these two are trivial thanks to the 'install_misc' base class in cmd.py. (Minor tweaks and commentary by me; the code is untested so far.)
Diffstat (limited to 'Lib/distutils/cmd.py')
-rw-r--r--Lib/distutils/cmd.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/Lib/distutils/cmd.py b/Lib/distutils/cmd.py
index abb23c9..3937344 100644
--- a/Lib/distutils/cmd.py
+++ b/Lib/distutils/cmd.py
@@ -344,5 +344,35 @@ class Command:
# class Command
+class install_misc (Command):
+ """Common base class for installing some files in a subdirectory.
+ Currently used by install_data and install_scripts.
+ """
+
+ user_options = [('install-dir=', 'd', "directory to install the files to")]
+
+ def initialize_options (self):
+ self.install_dir = None
+ self.outfiles = None
+
+ def _install_dir_from(self, dirname):
+ self.set_undefined_options('install', (dirname, 'install_dir'))
+
+ def _copydata(self, filelist):
+ self.outfiles = []
+ if not filelist:
+ return
+ self.mkpath(self.install_dir)
+ for f in filelist:
+ self.outfiles.append(self.copy_file (f, self.install_dir))
+
+ def _outputdata(self, filelist):
+ if self.outfiles is not None:
+ return self.outfiles
+ # XXX de-lambda-fy
+ return map(lambda x: os.path.join(self.install_dir, x), filelist)
+
+
+
if __name__ == "__main__":
print "ok"