Exemplo n.º 1
0
    def __init__(self):

        # Python 3 is required!
        if sys.version_info[0] < 3:
            sys.stdout.write("Sorry, requires Python 3.x, not Python 2.x\n")
            sys.exit(1)

        # Get args right at the start
        self.args = None
        if not self.args:
            self.read_arguments()

        # Load config right at the start
        self.config = None
        if not self.config:
            self.config = Config.load_config()
            logging.debug("Loaded Config:")
            logging.debug(self.config)

        # Check if Database exists, else create
        if not os.path.isfile(self.config["Database"]):
            helper.createFolder(self.config["SaveLocation"])
            helper.createDB()

        # Check weather there are some database migrations
        mversion = helper.getMigrationVersion() + ".py"
        if self.config["DisableMigrations"] == "True":
            logging.debug("Migrations disabled! Current version: %s ",
                          mversion)
        else:
            if mversion in os.listdir(os.getcwd() + "/migrations"):
                logging.debug("No migrations required! Current version: %s ",
                              mversion)
            else:
                migrator.migrate()
Exemplo n.º 2
0
    def __init__(self):

        # Python 3 is required!
        if sys.version_info[0] < 3:
            sys.stdout.write("Sorry, requires Python 3.x, not Python 2.x\n")
            sys.exit(1)

        # Get args right at the start
        self.args = None
        if not self.args:
            self.read_arguments()

        # Load config right at the start
        self.config = None
        if not self.config:
            self.config = Config.load_config()
            logging.debug("Loaded Config:")
            logging.debug(self.config)

        # Check if Database exists, else create
        if not os.path.isfile(self.config["Database"]):
            helper.createFolder(self.config["SaveLocation"])
            helper.createDB()
Exemplo n.º 3
0
 def create_db(self):
     helper.createDB()