瀏覽代碼

Clearer error message when config file not there

Thomas Kluyver 8 年之前
父節點
當前提交
08759ee6ba
共有 2 個文件被更改,包括 3 次插入1 次删除
  1. 1 0
      doc/releasenotes.rst
  2. 2 1
      nsist/configreader.py

+ 1 - 0
doc/releasenotes.rst

@@ -15,6 +15,7 @@ Version 1.10
 * Fixed an error when using wheels which install files into the same package,
   such as ``PyQt5`` and ``PyQtChart``.
 * Issue a warning when we can't find the cache directory on Windows.
+* Clearer error if the specified config file is not found.
 
 Version 1.9
 -----------

+ 2 - 1
nsist/configreader.py

@@ -102,7 +102,8 @@ def read_and_validate(config_file):
     # Interpolation interferes with Windows-style environment variables, so
     # it's disabled for now.
     config = configparser.ConfigParser(interpolation=None)
-    config.read(config_file)
+    if config.read(config_file) == []:
+        raise InvalidConfig("Config file not found: %r" % config_file)
     for section in config.sections():
         if section in CONFIG_VALIDATORS:
             CONFIG_VALIDATORS[section].check(config, section)