annotate Lib/distutils/command/install_headers.py @ 58925:eecf1bef052d 2.6

Merged revisions 78207 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r78207 | ezio.melotti | 2010-02-17 01:26:09 +0200 (Wed, 17 Feb 2010) | 1 line #7930: fix stripid ........
author Ezio Melotti <ezio.melotti@gmail.com>
date Tue, 16 Feb 2010 23:29:44 +0000
parents 1d84bf5f9478
children a5229237eb50
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
1 """distutils.command.install_headers
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
2
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
3 Implements the Distutils 'install_headers' command, to install C/C++ header
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
4 files to the Python include directory."""
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
5
33965
893d46576737 Update compatibility comments to 2.1, corresponding to PEP 291 1.13.
Martin v. Löwis <martin@v.loewis.de>
parents: 26285
diff changeset
6 # This module should be kept compatible with Python 2.1.
26285
42bfc98d295b Add comment to Distutil files about requiring 1.5.2 compatibility, as
Andrew M. Kuchling <amk@amk.ca>
parents: 26210
diff changeset
7
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
8 __revision__ = "$Id$"
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
9
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
10 from distutils.core import Command
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
11
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
12
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
13 class install_headers (Command):
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
14
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
15 description = "install C/C++ header files"
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
16
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
17 user_options = [('install-dir=', 'd',
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
18 "directory to install header files to"),
14540
35ae8dff8ed0 Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents: 13413
diff changeset
19 ('force', 'f',
35ae8dff8ed0 Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents: 13413
diff changeset
20 "force installation (overwrite existing files)"),
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
21 ]
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
22
14829
b1f220f636ed Added 'boolean_options' list to support config file parsing.
Greg Ward <gward@python.net>
parents: 14540
diff changeset
23 boolean_options = ['force']
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
24
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
25 def initialize_options (self):
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
26 self.install_dir = None
14540
35ae8dff8ed0 Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents: 13413
diff changeset
27 self.force = 0
13413
7fea4a1af090 fix inconsistent use of tabs and spaces
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 12982
diff changeset
28 self.outfiles = []
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
29
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
30 def finalize_options (self):
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
31 self.set_undefined_options('install',
14540
35ae8dff8ed0 Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents: 13413
diff changeset
32 ('install_headers', 'install_dir'),
35ae8dff8ed0 Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents: 13413
diff changeset
33 ('force', 'force'))
21268
d296e6bb17e5 Whitespace normalization.
Fred Drake <fdrake@acm.org>
parents: 14945
diff changeset
34
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
35
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
36 def run (self):
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
37 headers = self.distribution.headers
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
38 if not headers:
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
39 return
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
40
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
41 self.mkpath(self.install_dir)
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
42 for header in headers:
14945
a59600a975d1 Expect a tuple (dest_name, copied) from 'copy_file()'.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
43 (out, _) = self.copy_file(header, self.install_dir)
12981
9569c5625765 Build the 'outfiles' list so 'get_outputs()' has something to return.
Greg Ward <gward@python.net>
parents: 12776
diff changeset
44 self.outfiles.append(out)
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
45
12981
9569c5625765 Build the 'outfiles' list so 'get_outputs()' has something to return.
Greg Ward <gward@python.net>
parents: 12776
diff changeset
46 def get_inputs (self):
9569c5625765 Build the 'outfiles' list so 'get_outputs()' has something to return.
Greg Ward <gward@python.net>
parents: 12776
diff changeset
47 return self.distribution.headers or []
9569c5625765 Build the 'outfiles' list so 'get_outputs()' has something to return.
Greg Ward <gward@python.net>
parents: 12776
diff changeset
48
9569c5625765 Build the 'outfiles' list so 'get_outputs()' has something to return.
Greg Ward <gward@python.net>
parents: 12776
diff changeset
49 def get_outputs (self):
9569c5625765 Build the 'outfiles' list so 'get_outputs()' has something to return.
Greg Ward <gward@python.net>
parents: 12776
diff changeset
50 return self.outfiles
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
51
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
52 # class install_headers