Mymacroprocessor
python file macro processor
Support label
if,ifdef,ifndef,elif,else,endif,defined,define,undef
test.py
#%indentunit 4
#%define #dbglog(x) print(x)
##%log:1
#%define DEBUG
#%define TEST
#dbglog("test1")
#dbglog("test2")
#dbglog("test3")
#%if defined TEST:
print("this is test code.")
#%if defined TEST1:
print("--------TEST1----------.")
#%endif
#%else:
print("--------1----------.")
print("--------2----------.")
#%endif
command
python .\Mymacroprocessor.py .\test3.py
out
##%log:1
print("test1")
print("test2")
print("test3")
print("this is test code.")
call function
testcontent1='''
#%indentunit 4
#%define dbglog(x) ##(x)
##%log:1
#%define DEBUG
#%define TEST1
dbglog("test1")
dbglog("娴嬭瘯2")
dbglog("娴嬭瘯3")
#%if defined TEST:
print("this is test code.")
#%if defined TEST1:
print("--------TEST1----------.")
#%endif
#%else:
print("--------1----------.")
print("--------2----------.")
#%endif
#%if defined DEBUG:
M1
#%endif
'''
pyp=Mymacroprocessor()
newcontents=pyp.pymprocessor(testcontent1)
print("--new code---\n"+newcontents)
Metadata
Release files for Mymacroprocessor 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| Mymacroprocessor-0.0.3.tar.gz | 8.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Mymacroprocessor-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.2 kB
Release files / Mymacroprocessor-0.0.3.tar.gz
| Download URL | Mymacroprocessor-0.0.3.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d0f753165e698e4aab29887c0990e9bf05fc62f8e1bcd1166fba3235e999e70a
|
|
BLAKE2b-256 checksum How to use checksums |
71c637bbca70c06ad317e05b393c3e833cd3c8f3e80ad861d77daca646a9de26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
|
Release files / Mymacroprocessor-0.0.3-py3-none-any.whl
| Download URL | Mymacroprocessor-0.0.3-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
460376d2040b3686c02be903550f23682ce367f2477e2523666dddd85459ff52
|
|
BLAKE2b-256 checksum How to use checksums |
0508616b9abdab08905c7df57378a4f68d8037662cbd8df94cb2ffa4054aeced
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
|