mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-45866: pegen strips directory of "generated from" header (GH-29777)
"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.
This commit is contained in:
parent
ee1e2c604c
commit
253b7a0a9f
5 changed files with 12 additions and 4 deletions
|
@ -1,3 +1,4 @@
|
|||
import os.path
|
||||
import token
|
||||
from typing import IO, Any, Dict, Optional, Sequence, Set, Text, Tuple
|
||||
|
||||
|
@ -212,7 +213,8 @@ class PythonParserGenerator(ParserGenerator, GrammarVisitor):
|
|||
self.collect_rules()
|
||||
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue