Files
kube-hunter/install_imports.py
danielsagi 889a77d939 Pyinstaller/py2exe support (#157)
* removed unnecessary imports from main file

* added a script that generates static __init__ files based on existing modules

* added documentation

* added installing of plugins imports to script
2019-07-29 05:47:36 -07:00

18 lines
578 B
Python

from os.path import basename
import glob
def get_py_files(path):
for py_file in glob.glob("{}*.py".format(path)):
if not py_file.endswith("__init__.py"):
yield basename(py_file)[:-3]
def install_static_imports(path):
with open("{}__init__.py".format(path), 'w') as init_f:
for pf in get_py_files(path):
init_f.write("from .{} import *\n".format(pf))
install_static_imports("src/modules/discovery/")
install_static_imports("src/modules/hunting/")
install_static_imports("src/modules/report/")
install_static_imports("plugins/")