From a1886e2dde214bf28d5d17d77807b7bd469d2b64 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Sun, 10 Sep 2017 13:37:31 +0200 Subject: [PATCH] Remove dbtools dependency in setup.py --- setup.py | 51 ++------------------------------------------------- 1 file changed, 2 insertions(+), 49 deletions(-) diff --git a/setup.py b/setup.py index 6503cfd..c2a54b5 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -import configparser, os.path, tweepy, dbtools, getpass +import configparser, os.path, tweepy, getpass if os.path.isfile("config.cfg"): print("config.cfg already exists. Please remove it before running this script.") @@ -8,56 +8,9 @@ if os.path.isfile("config.cfg"): config = configparser.RawConfigParser() -config.add_section('Database') - -print('''SBTools will use a database for certain tasks. You can use a file or a MySQL database for this purpose. - -If you wish to use a MySQL database, you will need the credentials for it. If you don't know what any of that means, stick with the default value and just press Enter. -''') - -dbtype = input("Database type: %i (file), %i (MySQL) [%i]: " % (dbtools.SQLITE, dbtools.MYSQL, dbtools.SQLITE)) -print() - -try: - dbtype = int(dbtype) -except: - pass - -if dbtype == dbtools.MYSQL: - dbhost = input("MySQL host [localhost]: ") or "localhost" - dbuser = input("MySQL username [twitools]: ") or "twitools" - dbpass = getpass.getpass("MySQL password (not echoed!): ") - dbname = input("MySQL database name [twitools]: ") or "twitools" - print() - - config.set('Database', 'type', dbtype) - config.set('Database', 'host', dbhost) - config.set('Database', 'user', dbuser) - config.set('Database', 'pass', dbpass) - config.set('Database', 'name', dbname) - -else: - dbtype = dbtools.SQLITE - dbpath = input("Name of the database file [Database.db]: ") or "Database.db" - print() - - config.set('Database', 'type', dbtype) - config.set('Database', 'path', dbpath) - -if dbtype == dbtools.MYSQL: - db = dbtools.dbObject(dbtype=dbtype, host=dbhost, user=dbuser, pwd=dbpass, db=dbname) -else: - db = dbtools.dbObject(dbtype=dbtype, path=dbpath) -if not db.isInitialized(): - db.executeQuery("CREATE TABLE messages(`id` INTEGER NOT NULL, `text` TEXT, `sender_id` VARCHAR(60), `recipient_id` VARCHAR(60), `created_at` TEXT, PRIMARY KEY(id));") - db.executeQuery("CREATE TABLE photos(`mid` TEXT, `pid` TEXT);") - db.commit() - -db.closeConnection() - config.add_section("SB") -print('''In the next step, we'll get you connected to ScriptzBase. For this, we +print('''In order to use SBTools, we'll get you connected to ScriptzBase. We will need your username and password. Please note that these will be stored on your hard disk in plain text. Sadly ScriptzBase doesn't offer a better way for third party applications to authenticate...