diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2017-08-28 09:32:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-28 09:32:25 -0400 |
commit | 9e708961e7fa64e56c9469ca52163d7e2df31477 (patch) | |
tree | 526a0501545491ad910799994529b939367e38bd /setuptools/config.py | |
parent | 3c25384fce3f6134a342ab32b7afc54cc6066fa3 (diff) | |
download | external_python_setuptools-9e708961e7fa64e56c9469ca52163d7e2df31477.tar.gz external_python_setuptools-9e708961e7fa64e56c9469ca52163d7e2df31477.tar.bz2 external_python_setuptools-9e708961e7fa64e56c9469ca52163d7e2df31477.zip |
Need to perform the local assertion before checking for existence.
Diffstat (limited to 'setuptools/config.py')
-rw-r--r-- | setuptools/config.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/setuptools/config.py b/setuptools/config.py index 75f829fb..9a62e2ec 100644 --- a/setuptools/config.py +++ b/setuptools/config.py @@ -262,21 +262,20 @@ class ConfigHandler(object): spec = value[len(include_directive):] filepaths = (os.path.abspath(path.strip()) for path in spec.split(',')) return '\n'.join( - cls._read_local_file(path) + cls._read_file(path) for path in filepaths - if os.path.isfile(path) + if (cls._assert_local(path) or True) + and os.path.isfile(path) ) @staticmethod - def _read_local_file(filepath): - """ - Read contents of filepath. Raise error if the file - isn't in the current directory. - """ + def _assert_local(filepath): if not filepath.startswith(os.getcwd()): raise DistutilsOptionError( '`file:` directive can not access %s' % filepath) + @staticmethod + def _read_file(filepath): with io.open(filepath, encoding='utf-8') as f: return f.read() |