diff options
author | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-10-15 13:11:16 +0200 |
---|---|---|
committer | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-10-16 02:46:31 +0200 |
commit | 0210e394e0776d0b7097bf666bebd690ed0c0e4f (patch) | |
tree | e74014dd49c93f75b8cf388d700b681a321d261b /git/config.py | |
parent | a2d248bb8362808121f6b6abfd316d83b65afa79 (diff) | |
download | gitpython-0210e394e0776d0b7097bf666bebd690ed0c0e4f.tar.gz |
src: import os.path as osp
Diffstat (limited to 'git/config.py')
-rw-r--r-- | git/config.py | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/git/config.py b/git/config.py index eddfac15..a0b25822 100644 --- a/git/config.py +++ b/git/config.py @@ -6,21 +6,13 @@ """Module containing module parser implementation able to properly read and write configuration files""" -import re -try: - import ConfigParser as cp -except ImportError: - # PY3 - import configparser as cp +import abc +from functools import wraps import inspect import logging -import abc import os +import re -from functools import wraps - -from git.odict import OrderedDict -from git.util import LockFile from git.compat import ( string_types, FileType, @@ -29,6 +21,18 @@ from git.compat import ( with_metaclass, PY3 ) +from git.odict import OrderedDict +from git.util import LockFile + +import os.path as osp + + +try: + import ConfigParser as cp +except ImportError: + # PY3 + import configparser as cp + __all__ = ('GitConfigParser', 'SectionConstraint') @@ -408,15 +412,15 @@ class GitConfigParser(with_metaclass(MetaParserBuilder, cp.RawConfigParser, obje if self._has_includes(): for _, include_path in self.items('include'): if include_path.startswith('~'): - include_path = os.path.expanduser(include_path) - if not os.path.isabs(include_path): + include_path = osp.expanduser(include_path) + if not osp.isabs(include_path): if not file_ok: continue # end ignore relative paths if we don't know the configuration file path - assert os.path.isabs(file_path), "Need absolute paths to be sure our cycle checks will work" - include_path = os.path.join(os.path.dirname(file_path), include_path) + assert osp.isabs(file_path), "Need absolute paths to be sure our cycle checks will work" + include_path = osp.join(osp.dirname(file_path), include_path) # end make include path absolute - include_path = os.path.normpath(include_path) + include_path = osp.normpath(include_path) if include_path in seen or not os.access(include_path, os.R_OK): continue seen.add(include_path) |