mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
recipetool: create: npm: Remove duplicate function to not have future conflicts
Npm packages do not have yocto friendly names. fore instance we can have names like "@example/npmPackage" npm fetcher has a function that convert these names to yocto friendly names. But in recipe tool we have an other function (duplicate). (From OE-Core rev: 18e5438de5389b58c8b6a548d4474128d510a28d) Signed-off-by: BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
55f2e20350
commit
2a3888069f
|
@ -13,6 +13,7 @@ import sys
|
|||
import tempfile
|
||||
import bb
|
||||
from bb.fetch2.npm import NpmEnvironment
|
||||
from bb.fetch2.npm import npm_package
|
||||
from bb.fetch2.npmsw import foreach_dependencies
|
||||
from recipetool.create import RecipeHandler
|
||||
from recipetool.create import get_license_md5sums
|
||||
|
@ -30,15 +31,6 @@ def tinfoil_init(instance):
|
|||
class NpmRecipeHandler(RecipeHandler):
|
||||
"""Class to handle the npm recipe creation"""
|
||||
|
||||
@staticmethod
|
||||
def _npm_name(name):
|
||||
"""Generate a Yocto friendly npm name"""
|
||||
name = re.sub("/", "-", name)
|
||||
name = name.lower()
|
||||
name = re.sub(r"[^\-a-z0-9]", "", name)
|
||||
name = name.strip("-")
|
||||
return name
|
||||
|
||||
@staticmethod
|
||||
def _get_registry(lines):
|
||||
"""Get the registry value from the 'npm://registry' url"""
|
||||
|
@ -143,7 +135,7 @@ class NpmRecipeHandler(RecipeHandler):
|
|||
|
||||
# Handle the dependencies
|
||||
def _handle_dependency(name, params, deptree):
|
||||
suffix = "-".join([self._npm_name(dep) for dep in deptree])
|
||||
suffix = "-".join([npm_package(dep) for dep in deptree])
|
||||
destdirs = [os.path.join("node_modules", dep) for dep in deptree]
|
||||
destdir = os.path.join(*destdirs)
|
||||
packages["${PN}-" + suffix] = destdir
|
||||
|
@ -173,7 +165,7 @@ class NpmRecipeHandler(RecipeHandler):
|
|||
if "name" not in data or "version" not in data:
|
||||
return False
|
||||
|
||||
extravalues["PN"] = self._npm_name(data["name"])
|
||||
extravalues["PN"] = npm_package(data["name"])
|
||||
extravalues["PV"] = data["version"]
|
||||
|
||||
if "description" in data:
|
||||
|
|
Loading…
Reference in New Issue
Block a user