mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 00:14:41 +01:00
Fix amalgamation to not "unblack" __init__
files
This commit is contained in:
parent
743a851389
commit
00f6d4a173
1 changed files with 5 additions and 2 deletions
|
@ -502,12 +502,15 @@ def read_exclude(pkg):
|
|||
|
||||
FAKE_LOAD = """
|
||||
import os as _os
|
||||
if _os.getenv('{debug}', ''):
|
||||
|
||||
if _os.getenv("{debug}", ""):
|
||||
pass
|
||||
else:
|
||||
import sys as _sys
|
||||
|
||||
try:
|
||||
from {pkg} import __amalgam__
|
||||
|
||||
{load}
|
||||
del __amalgam__
|
||||
except ImportError:
|
||||
|
@ -526,7 +529,7 @@ def rewrite_init(pkg, order, debug="DEBUG"):
|
|||
stop = i
|
||||
elif line.startswith("# amalgamate"):
|
||||
start = i
|
||||
t = "{1} = __amalgam__\n " "_sys.modules['{0}.{1}'] = __amalgam__"
|
||||
t = "{1} = __amalgam__\n " "_sys.modules[\"{0}.{1}\"] = __amalgam__"
|
||||
load = "\n ".join(t.format(pkg, m) for m in order)
|
||||
s = FAKE_LOAD.format(pkg=pkg, load=load, debug=debug)
|
||||
if start + 1 == stop:
|
||||
|
|
Loading…
Add table
Reference in a new issue