Skip to content

Commit 3a46d09

Browse files
committed
Use the correct TOML import for parsing
Signed-off-by: NucleonGodX <racerpro41@gmail.com>
1 parent 27f2cec commit 3a46d09

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

src/packagedcode/buildpack.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
#
2+
# Copyright (c) nexB Inc. and others. All rights reserved.
3+
# ScanCode is a trademark of nexB Inc.
14
# SPDX-License-Identifier: Apache-2.0
5+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+
# See https://github.com/nexB/scancode-toolkit for support or download.
7+
# See https://aboutcode.org for more information about nexB OSS projects.
8+
#
29

3-
import tomlkit
10+
import toml
411
from packagedcode import models
512
from packageurl import PackageURL
613

@@ -21,7 +28,7 @@ def parse(cls, location, package_only=False):
2128
Parse the buildpack.toml file at `location` and yield PackageData.
2229
"""
2330
with open(location, "r", encoding="utf-8") as f:
24-
data = tomlkit.parse(f.read())
31+
data = toml.load(f)
2532

2633
# Extract required fields
2734
api_version = data.get("api")
@@ -108,4 +115,4 @@ def parse(cls, location, package_only=False):
108115
extra_data={"id": buildpack_id}, # Store the id in extra_data
109116
)
110117

111-
yield models.PackageData.from_data(package_data, package_only)
118+
yield models.PackageData.from_data(package_data, package_only)

tests/packagedcode/test_buildpack.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
#
2+
# Copyright (c) nexB Inc. and others. All rights reserved.
3+
# ScanCode is a trademark of nexB Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+
# See https://github.com/nexB/scancode-toolkit for support or download.
7+
# See https://aboutcode.org for more information about nexB OSS projects.
8+
#
9+
110
import os
211
from packagedcode import buildpack
312
from commoncode.testcase import FileBasedTesting

0 commit comments

Comments
 (0)