Browse Source

Warn when we can't find the cache directory on Windows

Closes gh-109
Thomas Kluyver 8 years ago
parent
commit
5e2b4ce2d9
2 changed files with 8 additions and 0 deletions
  1. 1 0
      doc/releasenotes.rst
  2. 7 0
      nsist/util.py

+ 1 - 0
doc/releasenotes.rst

@@ -14,6 +14,7 @@ Version 1.10
   added to the 64-bit view of the registry.
 * 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.
 
 Version 1.9
 -----------

+ 7 - 0
nsist/util.py

@@ -1,9 +1,12 @@
 import os
 import errno
+import logging
 from pathlib import Path
 import requests
 import sys
 
+logger = logging.getLogger(__name__)
+
 PY3 = sys.version_info[0] >= 3
 
 if PY3:
@@ -43,6 +46,10 @@ def get_cache_dir(ensure_existence=False):
     else:
         # Windows (hopefully)
         local = os.environ.get('LOCALAPPDATA', None) or (os.path.expanduser('~\\AppData\\Local'))
+        if local.startswith('~'):
+            logger.warning("Could not find cache directory. Please set any of "
+                           "these environment variables: "
+                           "LOCALAPPDATA, HOME, USERPROFILE or HOMEPATH")
         p = Path(local, 'pynsist')
 
     if ensure_existence: