mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-10-30 19:20:40 -04:00 
			
		
		
		
	Also search config.h near the script
By default, this script looks for include/mbedtls/config.h relative to the current directory. This allows running config.py from outside the build tree. To support out-of-tree builds where config.h and config.py are in the source tree and the current directory is in the build tree, also try DIRECTORY_CONTAINING_SCRIPT/../include/mbedtls/config.h, and the equivalent with symbolic links traversed.
This commit is contained in:
		
							parent
							
								
									1854ec45af
								
							
						
					
					
						commit
						812f185bc8
					
				| @ -24,6 +24,7 @@ Basic usage, to read the Mbed TLS or Mbed Crypto configuration: | |||||||
| ## | ## | ||||||
| ## This file is part of Mbed TLS (https://tls.mbed.org) | ## This file is part of Mbed TLS (https://tls.mbed.org) | ||||||
| 
 | 
 | ||||||
|  | import os | ||||||
| import re | import re | ||||||
| 
 | 
 | ||||||
| class Setting: | class Setting: | ||||||
| @ -230,12 +231,20 @@ class ConfigFile(Config): | |||||||
|     and modify the configuration. |     and modify the configuration. | ||||||
|     """ |     """ | ||||||
| 
 | 
 | ||||||
|     default_path = 'include/mbedtls/config.h' |     _path_in_tree = 'include/mbedtls/config.h' | ||||||
|  |     default_path = [_path_in_tree, | ||||||
|  |                     os.path.join(os.path.dirname(__file__), | ||||||
|  |                                  os.pardir, | ||||||
|  |                                  _path_in_tree), | ||||||
|  |                     os.path.join(os.path.dirname(os.path.abspath(os.path.dirname(__file__))), | ||||||
|  |                                  _path_in_tree)] | ||||||
| 
 | 
 | ||||||
|     def __init__(self, filename=None): |     def __init__(self, filename=None): | ||||||
|         """Read the Mbed TLS configuration file.""" |         """Read the Mbed TLS configuration file.""" | ||||||
|         if filename is None: |         if filename is None: | ||||||
|             filename = self.default_path |             for filename in self.default_path: | ||||||
|  |                 if os.path.lexists(filename): | ||||||
|  |                     break | ||||||
|         super().__init__() |         super().__init__() | ||||||
|         self.filename = filename |         self.filename = filename | ||||||
|         self.current_section = 'header' |         self.current_section = 'header' | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Gilles Peskine
						Gilles Peskine