mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
bpo-45866: pegen strips directory of "generated from" header (GH-29777) (GH-29792)
"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 commit 253b7a0a9f)
This commit is contained in:
parent
3f024e27c2
commit
b6defde2af
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
|
||||
|
||||
|
|
@ -139,7 +140,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