#!python3
#coding=utf8

########################################################################
###                                                                  ###
### Created by Martin Genet, 2012-2022                               ###
###                                                                  ###
### University of California at San Francisco (UCSF), USA            ###
### Swiss Federal Institute of Technology (ETH), Zurich, Switzerland ###
### École Polytechnique, Palaiseau, France                           ###
###                                                                  ###
########################################################################

import os

########################################################################

def main():
    os.system("rm -rf *.pyc")

    init_file = open("__init__.py", "w", encoding='utf-8')
    init_file.write("#this file was generated by __init__.py.py\n\n")

    for filename in os.listdir("."):
        if filename.endswith(".py") and not filename.startswith("__init__"):
            init_file.write("from ."+filename[:-3]+" import *\n")

    # for (dirpath, dirnames, filenames) in os.walk("."):
    #     for filename in filenames:
    #         if filename.endswith(".py") and not filename.startswith("__init__"):
    #             init_file.write("from "+filename[:-3]+" import *\n")

    init_file.close()
    
if __name__ == '__main__':
    main()
