-
-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
If you have multiple files with and import
statements then --rename-globals
cannot be used.
For the files program.py
from library1 import NUMBER
import library2
instance = library2.SomethingClass()
print(NUMBER)
and library1.py
A=1.234
and library2.py
class SomethingClass():
def __init__(self):
self.name = "something"
these arguments
pyminify --remove-literal-statements --rename-globals --in-place program.py library1.py library2.py
produce output that does not work.
from library1 import NUMBER as A
import library2 as B
C=B.SomethingClass()
print(A)
A=1.234
class A:
def __init__(A):A._name='something'
One workaround here is to always import things with from
and do a hacky, fragile grep of that to produce symbols to be excluded using --preserve-globals
.
I'm using this on some MicroPython code to squeeze it into a small file system on the micro:bit and apart from this and maybe some issues with MicroPython's special const()
it works really well, thanks.
Metadata
Metadata
Assignees
Labels
No labels