Skip to content

Commit

Permalink
Checks for npm instead of runtime when building nodejs packages
Browse files Browse the repository at this point in the history
  • Loading branch information
lorengordon committed Oct 26, 2022
1 parent fa92a39 commit 1421c5b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions package.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ def plan(self, source_path, query):
hash = source_paths.append

def pip_requirements_step(path, prefix=None, required=False, tmp_dir=None):
command = runtime
requirements = path
if os.path.isdir(path):
requirements = os.path.join(path, 'requirements.txt')
Expand All @@ -657,16 +658,17 @@ def pip_requirements_step(path, prefix=None, required=False, tmp_dir=None):
raise RuntimeError(
'File not found: {}'.format(requirements))
else:
if not query.docker and not shutil.which(runtime):
if not query.docker and not shutil.which(command):
raise RuntimeError(
"Python interpreter version equal "
"to defined lambda runtime ({}) should be "
"available in system PATH".format(runtime))
"available in system PATH".format(command))

step('pip', runtime, requirements, prefix, tmp_dir)
hash(requirements)

def npm_requirements_step(path, prefix=None, required=False, tmp_dir=None):
command = "npm"
requirements = path
if os.path.isdir(path):
requirements = os.path.join(path, 'package.json')
Expand All @@ -675,11 +677,10 @@ def npm_requirements_step(path, prefix=None, required=False, tmp_dir=None):
raise RuntimeError(
'File not found: {}'.format(requirements))
else:
if not query.docker and not shutil.which(runtime):
if not query.docker and not shutil.which(command):
raise RuntimeError(
"Nodejs interpreter version equal "
"to defined lambda runtime ({}) should be "
"available in system PATH".format(runtime))
"Nodejs package manager ({}) should be "
"available in system PATH".format(command))

step('npm', runtime, requirements, prefix, tmp_dir)
hash(requirements)
Expand Down

0 comments on commit 1421c5b

Please sign in to comment.