diff --git a/bugwarrior/command.py b/bugwarrior/command.py index 4965a5753..f876e996f 100644 --- a/bugwarrior/command.py +++ b/bugwarrior/command.py @@ -35,7 +35,7 @@ def _get_section_name(flavor): def pull(dry_run, flavor): """ Pull down tasks from forges and add them to your taskwarrior tasks. - Relies on configuration in ~/.bugwarriorrc + Relies on configuration in bugwarriorrc """ twiggy.quickSetup() try: @@ -103,7 +103,7 @@ def targets(): @vault.command() def list(): pws = lst(targets()) - print "%i @oracle:use_keyring passwords in .bugwarriorrc" % len(pws) + print "%i @oracle:use_keyring passwords in bugwarriorrc" % len(pws) for section in pws: print "-", section diff --git a/bugwarrior/config.py b/bugwarrior/config.py index 94ff5ef98..43dea46f9 100644 --- a/bugwarrior/config.py +++ b/bugwarrior/config.py @@ -8,6 +8,7 @@ import twiggy from twiggy import log from twiggy.levels import name2level +from xdg import BaseDirectory def asbool(some_value): @@ -81,7 +82,7 @@ def load_example_rc(): error_template = """ ************************************************* -* There was a problem with your ~/.bugwarriorrc * +* There was a problem with your bugwarriorrc * * {msg} * Here's an example template to help: * ************************************************* @@ -131,9 +132,19 @@ def validate_config(config, main_section): def load_config(main_section): config = ConfigParser({'log.level': "DEBUG", 'log.file': None}) + path = None + first_path = BaseDirectory.load_first_config('bugwarrior') + if first_path is not None: + path = os.path.join(first_path, 'bugwarriorrc') + old_path = os.path.expanduser("~/.bugwarriorrc") + if path is None or not os.path.exists(path): + if os.path.exists(old_path): + path = old_path + else: + path = os.path.join(BaseDirectory.save_config_path('bugwarrior'), 'bugwarriorrc') config.readfp( codecs.open( - os.path.expanduser("~/.bugwarriorrc"), + path, "r", "utf-8", ) diff --git a/bugwarrior/docs/common_configuration.rst b/bugwarrior/docs/common_configuration.rst index a4ff0e38c..40f2c437f 100644 --- a/bugwarrior/docs/common_configuration.rst +++ b/bugwarrior/docs/common_configuration.rst @@ -106,7 +106,7 @@ regardless of what project was assigned by the service itself:: Password Management ------------------- -You need not store your password in plain text in your `~/.bugwarriorrc` file; +You need not store your password in plain text in your `bugwarriorrc` file; you can enter the following values to control where to gather your password from: diff --git a/bugwarrior/docs/configuration.rst b/bugwarrior/docs/configuration.rst index 2674e640a..0cb53f49b 100644 --- a/bugwarrior/docs/configuration.rst +++ b/bugwarrior/docs/configuration.rst @@ -7,7 +7,7 @@ Example Configuration :: - # Example ~/.bugwarriorrc + # Example bugwarriorrc # General stuff. [general] diff --git a/bugwarrior/docs/using.rst b/bugwarrior/docs/using.rst index 262bff0eb..db579ceb2 100644 --- a/bugwarrior/docs/using.rst +++ b/bugwarrior/docs/using.rst @@ -8,7 +8,7 @@ It's ideal to create a cron task like:: */15 * * * * /usr/bin/bugwarrior-pull Bugwarrior can emit desktop notifications when it adds or completes issues -to and from your local ``~/.task/`` db. If your ``~/.bugwarriorrc`` file has +to and from your local ``~/.task/`` db. If your ``bugwarriorrc`` file has notifications turned on, you'll also need to tell cron which display to use by adding the following to your crontab:: diff --git a/bugwarrior/services/activecollab2.py b/bugwarrior/services/activecollab2.py index 6ef9e778f..592e43193 100644 --- a/bugwarrior/services/activecollab2.py +++ b/bugwarrior/services/activecollab2.py @@ -45,7 +45,7 @@ def get_issue_generator(self, user_id, project_id, project_name): """ Approach: - 1. Get user ID from .bugwarriorrc file + 1. Get user ID from bugwarriorrc file 2. Get list of tickets from /user-tasks for a given project 3. For each ticket/task returned from #2, get ticket/task info and check if logged-in user is primary (look at `is_owner` and diff --git a/setup.py b/setup.py index 0255bcf01..8bacb1138 100644 --- a/setup.py +++ b/setup.py @@ -43,6 +43,7 @@ "dogpile.cache>=0.5.3", "lockfile>=0.9.1", "click", + "pyxdg", ], tests_require=[ "Mock",