From 28337bf4097a973066574546e31059cd7c487c22 Mon Sep 17 00:00:00 2001 From: Thomi Richards Date: Tue, 16 Jun 2015 18:18:10 +1200 Subject: [PATCH] Fix bug where config dir isn't created if it doesn't exist. --- gmailfilter/_command.py | 1 + gmailfilter/_connection.py | 3 +++ setup.py | 3 +++ 3 files changed, 7 insertions(+) diff --git a/gmailfilter/_command.py b/gmailfilter/_command.py index ca0d4c7..5af5063 100644 --- a/gmailfilter/_command.py +++ b/gmailfilter/_command.py @@ -23,6 +23,7 @@ def run(): else: run_new_filter() + def run_old_filter(): """Run the old, pre v1 filter agent. This will get deleted soon.""" rules_path = get_filter_file_or_raise() diff --git a/gmailfilter/_connection.py b/gmailfilter/_connection.py index af90ce4..6986adb 100644 --- a/gmailfilter/_connection.py +++ b/gmailfilter/_connection.py @@ -360,6 +360,9 @@ def read_config_file(cls, path=None): def write_template_config_file(cls, path=None): """Write a template config file to disk.""" path = path or default_credentials_file_location() + directory = os.path.dirname(path) + if not os.path.exists(directory): + os.makedirs(directory) with open(path, 'w') as template_file: template_file.write(textwrap.dedent(''' # Credentials config file. diff --git a/setup.py b/setup.py index cf7450a..8fcfe6f 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,8 @@ #!/usr/bin/env python3 +import sys + +assert sys.version >= '3' from setuptools.command.test import test as TestCommand from setuptools import find_packages, setup