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 12 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)
30 changes: 30 additions & 0 deletions src/packagedcode/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,15 @@ 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 is a direct, first-level dependency, '
'defined in the manifest of a package. False if this '
'is an indirect, transitive dependency resolved from '
'first level dependencies.'
)

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

is_private = Boolean(
default=False,
label='is private flag',
help='True if this is a private package, either not meant to be '
'published on a repository, and/or a local package without a '
'name and version used primarily to track dependencies and '
'other information, and build this package, for instance with '
'JavaScript and PHP applications.'
)

is_virtual = Boolean(
default=False,
label='is virtual flag',
help='True if this package is created only from a manifest or lockfile, '
'and not from its actual packaged code. The files of this package '
'are not present in the codebase.'
)

extra_data = Mapping(
label='extra data',
help='A mapping of arbitrary extra package data.',
Expand Down Expand Up @@ -1026,6 +1053,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