Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve dependencies and improve JS support #3779

Merged
merged 14 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions src/packagedcode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@
npm.NpmShrinkwrapJsonHandler,
npm.YarnLockV1Handler,
npm.YarnLockV2Handler,
npm.PnpmShrinkwrapYamlHandler,
npm.PnpmLockYamlHandler,
npm.PnpmWorkspaceYamlHandler,

nuget.NugetNupkgHandler,
nuget.NugetNuspecHandler,
Expand Down
5 changes: 4 additions & 1 deletion src/packagedcode/bower.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ def parse(cls, location, package_only=False):
with io.open(location, encoding='utf-8') as loc:
package_data = json.load(loc)

# note: having no name is not a problem for private packages. See #1514
name = package_data.get('name')
is_private = False
if not name:
is_private = True

description = package_data.get('description')
version = package_data.get('version')
Expand Down Expand Up @@ -99,5 +101,6 @@ def parse(cls, location, package_only=False):
homepage_url=homepage_url,
vcs_url=vcs_url,
dependencies=dependencies,
is_private=is_private,
)
yield models.PackageData.from_data(package_data, package_only)
27 changes: 27 additions & 0 deletions src/packagedcode/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,14 @@ class DependentPackage(ModelMixin):
'been resolved and this dependency url points to an '
'exact version.')

is_direct = Boolean(
default=True,
label='is direct flag',
help='True if this dependency version requirement is '
AyanSinhaMahapatra marked this conversation as resolved.
Show resolved Hide resolved
'a direct dependency relation between two packages '
'as opposed to a transitive dependency relation, '
'which are present in lockfiles/dependency list.')

resolved_package = Mapping(
label='resolved package data',
help='A mapping of resolved package data for this dependent package, '
Expand Down Expand Up @@ -682,6 +690,22 @@ class PackageData(IdentifiablePackageData):
'package type or datafile format.'
)

is_private = Boolean(
default=False,
label='is resolved flag',
AyanSinhaMahapatra marked this conversation as resolved.
Show resolved Hide resolved
help='True if the associated package for this package manifest '
AyanSinhaMahapatra marked this conversation as resolved.
Show resolved Hide resolved
'is never meant to be published to the corresponding package '
'repository, and is a private package.'
)

is_virtual = Boolean(
default=False,
label='is virtual flag',
help='True if this package or any of its files are not present in '
AyanSinhaMahapatra marked this conversation as resolved.
Show resolved Hide resolved
'the codebase, but this package was created from a resolved '
'package, typically present in a lockfile.'
)

extra_data = Mapping(
label='extra data',
help='A mapping of arbitrary extra package data.',
Expand Down Expand Up @@ -1026,6 +1050,9 @@ class DatafileHandler:
# Informational: Default primary language for this parser.
default_primary_language = None

# If the datafilehandler contains only resolved dependencies
is_lockfile = False

# Informational: Description of this parser
description = None

Expand Down
Loading
Loading