python_compile.py (522B)
- #!/usr/bin/python
- # SPDX-FileCopyrightText: 2019 deblob Authors <https://hacktivis.me/projects/deblob>
- # SPDX-License-Identifier: BSD-3-Clause
- import py_compile
- import sys
- for check in py_compile.PycInvalidationMode:
- name = check.name.lower()
- value = check.value
- src_file = "./test/fixtures/hello.py"
- dest_file = "./test/fixtures/pyc/hello.{}.{}.pyc".format(
- name, sys.implementation.cache_tag
- )
- print(dest_file)
- py_compile.compile(src_file, cfile=dest_file, invalidation_mode=check)