From c130ab1221b8e6bf290dd00e09986c87f1cc89cb Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Apr 29 2020 14:49:44 +0000 Subject: Drop detection of only bundled libraries This will ensure that the nodejs(engine) dependency is always added, along with any Suggests: optionalDependencies. Signed-off-by: Stephen Gallagher --- diff --git a/nodejs.req b/nodejs.req index 945c23a..64e83ef 100755 --- a/nodejs.req +++ b/nodejs.req @@ -610,39 +610,6 @@ def rpm_format(requirement, version_spec="*"): return requirement -def has_only_bundled_dependencies(module_dir_path): - """Determines if the module contains only bundled dependencies. - - Dependencies are considered un-bundled when they are symlinks - pointing outside the root module's tree. - - Arguments: - module_dir_path (str): - Path to the module directory (directory with ``package.json``). - - Returns: - bool: True if all dependencies are bundled, False otherwise. - """ - - module_root_path = os.path.abspath(module_dir_path) - dependency_root_path = os.path.join(module_root_path, "node_modules") - - try: - dependency_path_iter = ( - os.path.join(dependency_root_path, basename) - for basename in os.listdir(dependency_root_path) - ) - bundled_dependency_iter = ( - os.path.realpath(path) - for path in dependency_path_iter - if not os.path.islink(path) or not path.startswith(module_root_path) - ) - - return any(bundled_dependency_iter) - except OSError: # node_modules does not exist - return False - - def extract_dependencies(metadata_path, optional=False): """Extract all dependencies in RPM format from package metadata. @@ -659,9 +626,6 @@ def extract_dependencies(metadata_path, optional=False): TypeError: Invalid dependency data type. """ - if has_only_bundled_dependencies(os.path.dirname(metadata_path)): - return # skip - # Read metadata try: with open(metadata_path, mode="r") as metadata_file: