clean-npm-cache: Move up NODE_MODULES_CACHE_PATH for Travis.

This makes the code more readable and also will help simplify the
patch when we switch to yarn.
This commit is contained in:
Tim Abbott 2017-07-21 15:57:22 -07:00
parent 1b7aee7cd6
commit 35a041c3bd
1 changed files with 1 additions and 1 deletions

View File

@ -10,13 +10,13 @@ from scripts.lib.node_cache import generate_sha1sum_node_modules
NODE_MODULES_CACHE_PATH = "/srv/zulip-npm-cache"
if "--travis" in sys.argv:
NODE_MODULES_CACHE_PATH = os.path.join(os.environ["HOME"], "zulip-npm-cache")
try:
subprocess.check_output(['npm', '--version'])
except OSError:
print('NPM not found. Most probably we are running static-analysis and '
'hence npm is not installed. Exiting without cleaning npm cache.')
sys.exit(0)
NODE_MODULES_CACHE_PATH = os.path.join(os.environ["HOME"], "zulip-npm-cache")
sha1sum = generate_sha1sum_node_modules()
npm_cache = os.path.join(NODE_MODULES_CACHE_PATH, sha1sum)