diff --git a/MANIFEST.in b/MANIFEST.in index aae95799..86b597a9 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,2 @@ +graft src/vorta/assets recursive-exclude tests * diff --git a/setup.cfg b/setup.cfg index 8a3a5819..95275d77 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,9 +30,6 @@ setup_requires = pip >= 10 pytest-runner setuptools_git -include_package_data = True -find_packages = - exclude = tests install_requires = appdirs paramiko @@ -41,6 +38,7 @@ install_requires = python-dateutil keyring borgbackup + apscheduler [options.extras_require] tests = @@ -54,8 +52,7 @@ tests = [options.entry_points] gui_scripts = - vorta = vorta.__main__ - + vorta = vorta.__main__:main [tool:pytest] addopts = -vs @@ -68,3 +65,8 @@ filterwarnings = source = src [tox:tox] +envlist = py37 + +[tox:testenv] +deps=pytest +commands=pytest diff --git a/setup.py b/setup.py index acca8ee2..fbe687e8 100644 --- a/setup.py +++ b/setup.py @@ -1 +1,7 @@ -from setuptools import setup; setup() +from setuptools import setup, find_packages + +setup( + include_package_data=True, + packages=find_packages('src'), + package_dir={'': 'src'} +) diff --git a/src/vorta/__main__.py b/src/vorta/__main__.py index 742470ab..8525b135 100644 --- a/src/vorta/__main__.py +++ b/src/vorta/__main__.py @@ -6,14 +6,20 @@ from vorta.application import VortaApp from vorta.config import SETTINGS_DIR -# Send crashes to Sentry -if getattr(sys, 'frozen', False): - import sentry_sdk - sentry_sdk.init("https://a4a23df3e44743d5b5c5f06417a9a809@sentry.io/1311799") -# Init database -sqlite_db = peewee.SqliteDatabase(os.path.join(SETTINGS_DIR, 'settings.db')) -vorta.models.init_db(sqlite_db) +def main(): + # Send crashes to Sentry + if not os.environ.get('NO_SENTRY'): + import sentry_sdk + sentry_sdk.init("https://a4a23df3e44743d5b5c5f06417a9a809@sentry.io/1311799") -app = VortaApp(sys.argv) -sys.exit(app.exec_()) + # Init database + sqlite_db = peewee.SqliteDatabase(os.path.join(SETTINGS_DIR, 'settings.db')) + vorta.models.init_db(sqlite_db) + + app = VortaApp(sys.argv) + sys.exit(app.exec_()) + + +if __name__ == '__main__': + main() diff --git a/src/vorta/models.py b/src/vorta/models.py index c12b96f8..f5ee2f96 100644 --- a/src/vorta/models.py +++ b/src/vorta/models.py @@ -100,7 +100,7 @@ class Meta: class WifiSettingModel(pw.Model): """Save Wifi Settings""" ssid = pw.CharField() - last_connected = pw.DateTimeField() + last_connected = pw.DateTimeField(null=True) allowed = pw.BooleanField(default=True) profile = pw.ForeignKeyField(BackupProfileModel, default=1) diff --git a/src/vorta/utils.py b/src/vorta/utils.py index 22f5031f..e60c9153 100644 --- a/src/vorta/utils.py +++ b/src/vorta/utils.py @@ -81,7 +81,7 @@ def get_sorted_wifis(): wifis = plistlib.load(plist_file)['KnownNetworks'] if wifis: for wifi in wifis.values(): - timestamp = wifi['LastConnected'] + timestamp = wifi.get('LastConnected', None) ssid = wifi['SSIDString'] WifiSettingModel.get_or_create(ssid=ssid, profile=app.profile, defaults={'last_connected': timestamp,