mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	 45a5e3afe5
			
		
	
	
		45a5e3afe5
		
	
	
	
	
		
			
			This should make the Linux distros happy as it is now easier to leave importlib's tests out of their base Python distribution.
		
			
				
	
	
		
			20 lines
		
	
	
	
		
			475 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
	
		
			475 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| import imp
 | |
| from importlib import machinery
 | |
| import os
 | |
| import sys
 | |
| 
 | |
| PATH = None
 | |
| EXT = None
 | |
| FILENAME = None
 | |
| NAME = '_testcapi'
 | |
| try:
 | |
|     for PATH in sys.path:
 | |
|         for EXT in machinery.EXTENSION_SUFFIXES:
 | |
|             FILENAME = NAME + EXT
 | |
|             FILEPATH = os.path.join(PATH, FILENAME)
 | |
|             if os.path.exists(os.path.join(PATH, FILENAME)):
 | |
|                 raise StopIteration
 | |
|     else:
 | |
|         PATH = EXT = FILENAME = FILEPATH = None
 | |
| except StopIteration:
 | |
|     pass
 |