summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/recipetool/create_npm.py14
1 files changed, 3 insertions, 11 deletions
diff --git a/scripts/lib/recipetool/create_npm.py b/scripts/lib/recipetool/create_npm.py
index 3394a89970..e667a4d19b 100644
--- a/scripts/lib/recipetool/create_npm.py
+++ b/scripts/lib/recipetool/create_npm.py
@@ -13,6 +13,7 @@ import sys
13import tempfile 13import tempfile
14import bb 14import bb
15from bb.fetch2.npm import NpmEnvironment 15from bb.fetch2.npm import NpmEnvironment
16from bb.fetch2.npm import npm_package
16from bb.fetch2.npmsw import foreach_dependencies 17from bb.fetch2.npmsw import foreach_dependencies
17from recipetool.create import RecipeHandler 18from recipetool.create import RecipeHandler
18from recipetool.create import get_license_md5sums 19from recipetool.create import get_license_md5sums
@@ -31,15 +32,6 @@ class NpmRecipeHandler(RecipeHandler):
31 """Class to handle the npm recipe creation""" 32 """Class to handle the npm recipe creation"""
32 33
33 @staticmethod 34 @staticmethod
34 def _npm_name(name):
35 """Generate a Yocto friendly npm name"""
36 name = re.sub("/", "-", name)
37 name = name.lower()
38 name = re.sub(r"[^\-a-z0-9]", "", name)
39 name = name.strip("-")
40 return name
41
42 @staticmethod
43 def _get_registry(lines): 35 def _get_registry(lines):
44 """Get the registry value from the 'npm://registry' url""" 36 """Get the registry value from the 'npm://registry' url"""
45 registry = None 37 registry = None
@@ -143,7 +135,7 @@ class NpmRecipeHandler(RecipeHandler):
143 135
144 # Handle the dependencies 136 # Handle the dependencies
145 def _handle_dependency(name, params, deptree): 137 def _handle_dependency(name, params, deptree):
146 suffix = "-".join([self._npm_name(dep) for dep in deptree]) 138 suffix = "-".join([npm_package(dep) for dep in deptree])
147 destdirs = [os.path.join("node_modules", dep) for dep in deptree] 139 destdirs = [os.path.join("node_modules", dep) for dep in deptree]
148 destdir = os.path.join(*destdirs) 140 destdir = os.path.join(*destdirs)
149 packages["${PN}-" + suffix] = destdir 141 packages["${PN}-" + suffix] = destdir
@@ -173,7 +165,7 @@ class NpmRecipeHandler(RecipeHandler):
173 if "name" not in data or "version" not in data: 165 if "name" not in data or "version" not in data:
174 return False 166 return False
175 167
176 extravalues["PN"] = self._npm_name(data["name"]) 168 extravalues["PN"] = npm_package(data["name"])
177 extravalues["PV"] = data["version"] 169 extravalues["PV"] = data["version"]
178 170
179 if "description" in data: 171 if "description" in data: