diff --git a/CHANGELOG b/CHANGELOG index c8b8186..97e5b98 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ v0.3.1 (unreleased): exist on their remote after fetching. - Added a '--bookmark-file' option to support multiple bookmark config files. - Fixed a bug related to Python 3 compatibility. +- Fixed a bug related to absolute paths in bookmarks on Windows. v0.3 (released June 7, 2015): diff --git a/gitup/config.py b/gitup/config.py index 930056e..ac13208 100644 --- a/gitup/config.py +++ b/gitup/config.py @@ -8,9 +8,11 @@ from __future__ import print_function import os try: - import configparser + from configparser import ConfigParser, NoSectionError + py3k = True except ImportError: # Python 2 - import ConfigParser as configparser + from ConfigParser import SafeConfigParser as ConfigParser, NoSectionError + py3k = False from colorama import Fore, Style @@ -37,9 +39,12 @@ def _migrate_old_config_path(): os.rename(old_path, new_path) def _load_config_file(config_path=None): - """Read the config file and return a SafeConfigParser() object.""" + """Read the config file and return a config parser object.""" _migrate_old_config_path() - config = configparser.SafeConfigParser(delimiters='=') + if py3k: + config = ConfigParser(delimiters='=') + else: + config = ConfigParser() # Don't lowercase option names, because we are storing paths there: config.optionxform = lambda opt: opt config.read(config_path or get_default_config_path()) @@ -63,7 +68,7 @@ def get_bookmarks(config_path=None): config = _load_config_file(config_path) try: return [path for path, _ in config.items("bookmarks")] - except configparser.NoSectionError: + except NoSectionError: return [] def add_bookmarks(paths, config_path=None):