Sfoglia il codice sorgente

Raise an exception for useless glob paths

Adrien Ferrand 6 anni fa
parent
commit
f4afc8867c
2 ha cambiato i file con 10 aggiunte e 0 eliminazioni
  1. 3 0
      nsist/pypi.py
  2. 7 0
      nsist/tests/test_local_wheels.py

+ 3 - 0
nsist/pypi.py

@@ -267,6 +267,9 @@ def fetch_pypi_wheels(wheels_requirements, wheels_paths, target_dir, py_version,
         extract_wheel(whl_file, target_dir, exclude=exclude)
     # Then from the local_wheels paths parameter
     for glob_path in wheels_paths:
+        paths = glob.glob(glob_path)
+        if not paths:
+            raise ValueError('Error, glob path {0} does not match any wheel file'.format(glob_path))
         for path in glob.glob(glob_path):
             logger.info('Include wheel: %s (local_wheels path: %s)', os.path.basename(path), glob_path)
             validate_wheel(path, wheel_info_array, py_version)

+ 7 - 0
nsist/tests/test_local_wheels.py

@@ -55,3 +55,10 @@ class TestLocalWheels(unittest.TestCase):
                 with self.assertRaisesRegex(ValueError, '{0} does not support Python {1}'
                 .format('incompatiblewheel-1.0.0-py26-none-any.whl', platform.python_version())):
                     fetch_pypi_wheels([], [os.path.join(td1, '*.whl')], td2, platform.python_version(), 64)
+
+    def test_useless_wheel_glob_path_raise(self):
+        with TemporaryDirectory() as td1:
+            with TemporaryDirectory() as td2:
+                with self.assertRaisesRegex(ValueError, 'does not match any wheel file'
+                .format(td1)):
+                    fetch_pypi_wheels([], [os.path.join(td1, '*.whl')], td2, platform.python_version(), 64)