mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	 ca066bdbed
			
		
	
	
		ca066bdbed
		
			
		
	
	
	
	
		
			
			distutils was removed in November. However, the c-analyzer relies on it. To solve that here, we vendor the parts the tool needs so it can be run against 3.12+. (Also see gh-92584.) Note that we may end up removing this code later in favor of a solution in common with the peg_generator tool (which also relies on distutils). At the least, the copy here makes sure the c-analyzer tool works on 3.12+ in the meantime.
		
			
				
	
	
		
			29 lines
		
	
	
	
		
			910 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
	
		
			910 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| """distutils.dep_util
 | |
| 
 | |
| Utility functions for simple, timestamp-based dependency of files
 | |
| and groups of files; also, function based entirely on such
 | |
| timestamp dependency analysis."""
 | |
| 
 | |
| import os
 | |
| from distutils.errors import DistutilsFileError
 | |
| 
 | |
| 
 | |
| def newer (source, target):
 | |
|     """Return true if 'source' exists and is more recently modified than
 | |
|     'target', or if 'source' exists and 'target' doesn't.  Return false if
 | |
|     both exist and 'target' is the same age or younger than 'source'.
 | |
|     Raise DistutilsFileError if 'source' does not exist.
 | |
|     """
 | |
|     if not os.path.exists(source):
 | |
|         raise DistutilsFileError("file '%s' does not exist" %
 | |
|                                  os.path.abspath(source))
 | |
|     if not os.path.exists(target):
 | |
|         return 1
 | |
| 
 | |
|     from stat import ST_MTIME
 | |
|     mtime1 = os.stat(source)[ST_MTIME]
 | |
|     mtime2 = os.stat(target)[ST_MTIME]
 | |
| 
 | |
|     return mtime1 > mtime2
 | |
| 
 | |
| # newer ()
 |