Mercurial > cpython-lru_cache-weakref
annotate Lib/distutils/command/install_headers.py @ 58765:2ba7677bfa95 legacy-trunk
testCopysign was defined twice in test_math; combine the definitions
| author | Mark Dickinson <dickinsm@gmail.com> |
|---|---|
| date | Sat, 06 Feb 2010 23:11:25 +0000 |
| parents | 07c5c0d9e700 |
| children |
| 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 |
|
52587
07c5c0d9e700
added tests to the install_headers command
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
11 # XXX force is never used |
|
07c5c0d9e700
added tests to the install_headers command
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
12 class install_headers(Command): |
|
12776
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 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
|
15 |
|
342947f2fb51
Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
16 user_options = [('install-dir=', 'd', |
|
342947f2fb51
Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
17 "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
|
18 ('force', 'f', |
|
35ae8dff8ed0
Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents:
13413
diff
changeset
|
19 "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
|
20 ] |
|
342947f2fb51
Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
21 |
|
14829
b1f220f636ed
Added 'boolean_options' list to support config file parsing.
Greg Ward <gward@python.net>
parents:
14540
diff
changeset
|
22 boolean_options = ['force'] |
|
12776
342947f2fb51
Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
23 |
|
52587
07c5c0d9e700
added tests to the install_headers command
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
24 def initialize_options(self): |
|
12776
342947f2fb51
Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
25 self.install_dir = None |
|
14540
35ae8dff8ed0
Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents:
13413
diff
changeset
|
26 self.force = 0 |
|
13413
7fea4a1af090
fix inconsistent use of tabs and spaces
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
12982
diff
changeset
|
27 self.outfiles = [] |
|
12776
342947f2fb51
Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
28 |
|
52587
07c5c0d9e700
added tests to the install_headers command
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
29 def finalize_options(self): |
|
12776
342947f2fb51
Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
30 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
|
31 ('install_headers', 'install_dir'), |
|
35ae8dff8ed0
Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents:
13413
diff
changeset
|
32 ('force', 'force')) |
| 21268 | 33 |
|
12776
342947f2fb51
Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
34 |
|
52587
07c5c0d9e700
added tests to the install_headers command
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
35 def run(self): |
|
12776
342947f2fb51
Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
36 headers = self.distribution.headers |
|
342947f2fb51
Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
37 if not headers: |
|
342947f2fb51
Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
38 return |
|
342947f2fb51
Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
39 |
|
342947f2fb51
Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
40 self.mkpath(self.install_dir) |
|
342947f2fb51
Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
41 for header in headers: |
|
14945
a59600a975d1
Expect a tuple (dest_name, copied) from 'copy_file()'.
Greg Ward <gward@python.net>
parents:
14829
diff
changeset
|
42 (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
|
43 self.outfiles.append(out) |
|
12776
342947f2fb51
Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
44 |
|
52587
07c5c0d9e700
added tests to the install_headers command
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
45 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
|
46 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
|
47 |
|
52587
07c5c0d9e700
added tests to the install_headers command
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
48 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
|
49 return self.outfiles |
|
12776
342947f2fb51
Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
50 |
|
342947f2fb51
Added 'install_headers' command to install C/C++ header files.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
51 # class install_headers |
