Explorar o código

Clearer error message when config file not there

Thomas Kluyver %!s(int64=8) %!d(string=hai) anos
pai
achega
08759ee6ba
Modificáronse 2 ficheiros con 3 adicións e 1 borrados
  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,
 * Fixed an error when using wheels which install files into the same package,
   such as ``PyQt5`` and ``PyQtChart``.
   such as ``PyQt5`` and ``PyQtChart``.
 * Issue a warning when we can't find the cache directory on Windows.
 * 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
 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
     # Interpolation interferes with Windows-style environment variables, so
     # it's disabled for now.
     # it's disabled for now.
     config = configparser.ConfigParser(interpolation=None)
     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():
     for section in config.sections():
         if section in CONFIG_VALIDATORS:
         if section in CONFIG_VALIDATORS:
             CONFIG_VALIDATORS[section].check(config, section)
             CONFIG_VALIDATORS[section].check(config, section)