annotate Lib/distutils/command/install_headers.py @ 84007:dbfbdf2b5c19 3.3

Fix #17967: For ftp urls CWD to target instead of hopping to each directory towards target. This fixes a bug where target is accessible, but parent directories are restricted.
author Senthil Kumaran <senthil@uthcode.com>
date Sat, 01 Jun 2013 08:27:06 -0700
parents 3e26c9033306
children
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 from distutils.core import Command
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
52594
6640996f04e7 Merged revisions 70886,70888-70892 via svnmerge from
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 45471
diff changeset
9 # XXX force is never used
43026
a6d3930b5613 General cleanup, raise normalization in Lib/distutils.
Collin Winter <collinw@gmail.com>
parents: 33965
diff changeset
10 class install_headers(Command):
12776
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 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
13
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
14 user_options = [('install-dir=', 'd',
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
15 "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
16 ('force', 'f',
35ae8dff8ed0 Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents: 13413
diff changeset
17 "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
18 ]
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
19
14829
b1f220f636ed Added 'boolean_options' list to support config file parsing.
Greg Ward <gward@python.net>
parents: 14540
diff changeset
20 boolean_options = ['force']
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
21
43026
a6d3930b5613 General cleanup, raise normalization in Lib/distutils.
Collin Winter <collinw@gmail.com>
parents: 33965
diff changeset
22 def initialize_options(self):
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
23 self.install_dir = None
14540
35ae8dff8ed0 Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents: 13413
diff changeset
24 self.force = 0
13413
7fea4a1af090 fix inconsistent use of tabs and spaces
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 12982
diff changeset
25 self.outfiles = []
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
26
43026
a6d3930b5613 General cleanup, raise normalization in Lib/distutils.
Collin Winter <collinw@gmail.com>
parents: 33965
diff changeset
27 def finalize_options(self):
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
28 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
29 ('install_headers', 'install_dir'),
35ae8dff8ed0 Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents: 13413
diff changeset
30 ('force', 'force'))
21268
d296e6bb17e5 Whitespace normalization.
Fred Drake <fdrake@acm.org>
parents: 14945
diff changeset
31
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
32
43026
a6d3930b5613 General cleanup, raise normalization in Lib/distutils.
Collin Winter <collinw@gmail.com>
parents: 33965
diff changeset
33 def run(self):
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
34 headers = self.distribution.headers
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
35 if not headers:
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
36 return
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
37
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
38 self.mkpath(self.install_dir)
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
39 for header in headers:
14945
a59600a975d1 Expect a tuple (dest_name, copied) from 'copy_file()'.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
40 (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
41 self.outfiles.append(out)
12776
342947f2fb51 Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff changeset
42
43026
a6d3930b5613 General cleanup, raise normalization in Lib/distutils.
Collin Winter <collinw@gmail.com>
parents: 33965
diff changeset
43 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
44 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
45
43026
a6d3930b5613 General cleanup, raise normalization in Lib/distutils.
Collin Winter <collinw@gmail.com>
parents: 33965
diff changeset
46 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
47 return self.outfiles