| 
									
										
										
										
											2000-05-27 01:25:16 +00:00
										 |  |  | """distutils.command.install_headers
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Implements the Distutils 'install_headers' command, to install C/C++ header | 
					
						
							|  |  |  | files to the Python include directory."""
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-11-19 13:12:28 +00:00
										 |  |  | # This module should be kept compatible with Python 1.5.2. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-05-27 01:25:16 +00:00
										 |  |  | __revision__ = "$Id$" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-06-21 03:13:51 +00:00
										 |  |  | import os | 
					
						
							| 
									
										
										
										
											2000-05-27 01:25:16 +00:00
										 |  |  | from distutils.core import Command | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class install_headers (Command): | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     description = "install C/C++ header files" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     user_options = [('install-dir=', 'd', | 
					
						
							|  |  |  |                      "directory to install header files to"), | 
					
						
							| 
									
										
										
										
											2000-09-13 01:02:25 +00:00
										 |  |  |                     ('force', 'f', | 
					
						
							|  |  |  |                      "force installation (overwrite existing files)"), | 
					
						
							| 
									
										
										
										
											2000-05-27 01:25:16 +00:00
										 |  |  |                    ] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-09-25 01:41:15 +00:00
										 |  |  |     boolean_options = ['force'] | 
					
						
							| 
									
										
										
										
											2000-05-27 01:25:16 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def initialize_options (self): | 
					
						
							|  |  |  |         self.install_dir = None | 
					
						
							| 
									
										
										
										
											2000-09-13 01:02:25 +00:00
										 |  |  |         self.force = 0 | 
					
						
							| 
									
										
										
										
											2000-07-07 20:45:21 +00:00
										 |  |  |         self.outfiles = [] | 
					
						
							| 
									
										
										
										
											2000-05-27 01:25:16 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def finalize_options (self): | 
					
						
							|  |  |  |         self.set_undefined_options('install', | 
					
						
							| 
									
										
										
										
											2000-09-13 01:02:25 +00:00
										 |  |  |                                    ('install_headers', 'install_dir'), | 
					
						
							|  |  |  |                                    ('force', 'force')) | 
					
						
							| 
									
										
										
										
											2001-12-06 21:01:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-05-27 01:25:16 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def run (self): | 
					
						
							|  |  |  |         headers = self.distribution.headers | 
					
						
							|  |  |  |         if not headers: | 
					
						
							|  |  |  |             return | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.mkpath(self.install_dir) | 
					
						
							|  |  |  |         for header in headers: | 
					
						
							| 
									
										
										
										
											2000-09-30 17:34:50 +00:00
										 |  |  |             (out, _) = self.copy_file(header, self.install_dir) | 
					
						
							| 
									
										
										
										
											2000-06-21 03:13:51 +00:00
										 |  |  |             self.outfiles.append(out) | 
					
						
							| 
									
										
										
										
											2000-05-27 01:25:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-06-21 03:13:51 +00:00
										 |  |  |     def get_inputs (self): | 
					
						
							|  |  |  |         return self.distribution.headers or [] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def get_outputs (self): | 
					
						
							|  |  |  |         return self.outfiles | 
					
						
							| 
									
										
										
										
											2000-05-27 01:25:16 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | # class install_headers |