annotate Lib/distutils/command/install_headers.py @ 51749:1408feec0084 3.0

Merged revisions 69798 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r69798 | benjamin.peterson | 2009-02-19 22:02:38 -0600 (Thu, 19 Feb 2009) | 13 lines Merged revisions 69769,69776 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r69769 | georg.brandl | 2009-02-19 02:30:06 -0600 (Thu, 19 Feb 2009) | 1 line #5310, #3558: fix operator precedence table. ........ r69776 | georg.brandl | 2009-02-19 10:34:51 -0600 (Thu, 19 Feb 2009) | 2 lines #5317: update IronPython URL. ........ ................
author Benjamin Peterson <benjamin@python.org>
date Fri, 20 Feb 2009 04:05:32 +0000
parents 7dd2c1746267
children 6640996f04e7
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
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
6 __revision__ = "$Id$"
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
7
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
8 from distutils.core import Command
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
43026
a6d3930b5613 General cleanup, raise normalization in Lib/distutils.
Collin Winter <collinw@gmail.com>
parents: 33965
diff changeset
11 class install_headers(Command):
12776
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 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
14
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
15 user_options = [('install-dir=', 'd',
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
16 "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
17 ('force', 'f',
35ae8dff8ed0 Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents: 13413
diff changeset
18 "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
19 ]
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
20
14829
b1f220f636ed Added 'boolean_options' list to support config file parsing.
Greg Ward <gward@python.net>
parents: 14540
diff changeset
21 boolean_options = ['force']
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
22
43026
a6d3930b5613 General cleanup, raise normalization in Lib/distutils.
Collin Winter <collinw@gmail.com>
parents: 33965
diff changeset
23 def initialize_options(self):
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
24 self.install_dir = None
14540
35ae8dff8ed0 Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents: 13413
diff changeset
25 self.force = 0
13413
7fea4a1af090 fix inconsistent use of tabs and spaces
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 12982
diff changeset
26 self.outfiles = []
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
27
43026
a6d3930b5613 General cleanup, raise normalization in Lib/distutils.
Collin Winter <collinw@gmail.com>
parents: 33965
diff changeset
28 def finalize_options(self):
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
29 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
30 ('install_headers', 'install_dir'),
35ae8dff8ed0 Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents: 13413
diff changeset
31 ('force', 'force'))
21268
d296e6bb17e5 Whitespace normalization.
Fred Drake <fdrake@acm.org>
parents: 14945
diff changeset
32
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
33
43026
a6d3930b5613 General cleanup, raise normalization in Lib/distutils.
Collin Winter <collinw@gmail.com>
parents: 33965
diff changeset
34 def run(self):
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
35 headers = self.distribution.headers
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
36 if not headers:
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
37 return
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
38
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
39 self.mkpath(self.install_dir)
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
40 for header in headers:
14945
a59600a975d1 Expect a tuple (dest_name, copied) from 'copy_file()'.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
41 (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
42 self.outfiles.append(out)
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
43
43026
a6d3930b5613 General cleanup, raise normalization in Lib/distutils.
Collin Winter <collinw@gmail.com>
parents: 33965
diff changeset
44 def get_inputs(self):
12981
9569c5625765 Build the 'outfiles' list so 'get_outputs()' has something to return.
Greg Ward <gward@python.net>
parents: 12776
diff changeset
45 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
46
43026
a6d3930b5613 General cleanup, raise normalization in Lib/distutils.
Collin Winter <collinw@gmail.com>
parents: 33965
diff changeset
47 def get_outputs(self):
12981
9569c5625765 Build the 'outfiles' list so 'get_outputs()' has something to return.
Greg Ward <gward@python.net>
parents: 12776
diff changeset
48 return self.outfiles