mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	bpo-45866: pegen strips directory of "generated from" header (GH-29777) (GH-29792) (GH-29797)
"make regen-all" now produces the same output when run from a directory other than the source tree: when building Python out of the source tree. (cherry picked from commit253b7a0a9f) (cherry picked from commitb6defde2af)
This commit is contained in:
		
							parent
							
								
									92631a4144
								
							
						
					
					
						commit
						93a540d74c
					
				
					 5 changed files with 12 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -1,3 +1,4 @@
 | 
			
		|||
import os.path
 | 
			
		||||
import token
 | 
			
		||||
from typing import Any, Dict, Optional, IO, Text, Tuple
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -142,7 +143,8 @@ def __init__(
 | 
			
		|||
    def generate(self, filename: str) -> None:
 | 
			
		||||
        header = self.grammar.metas.get("header", MODULE_PREFIX)
 | 
			
		||||
        if header is not None:
 | 
			
		||||
            self.print(header.rstrip("\n").format(filename=filename))
 | 
			
		||||
            basename = os.path.basename(filename)
 | 
			
		||||
            self.print(header.rstrip("\n").format(filename=basename))
 | 
			
		||||
        subheader = self.grammar.metas.get("subheader", "")
 | 
			
		||||
        if subheader:
 | 
			
		||||
            self.print(subheader.format(filename=filename))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue