bibliothecary 14.0.1 → 14.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -1
- data/CHANGELOG.md +22 -0
- data/lib/bibliothecary/dependency.rb +2 -1
- data/lib/bibliothecary/parsers/cran.rb +1 -1
- data/lib/bibliothecary/parsers/maven.rb +3 -4
- data/lib/bibliothecary/parsers/nuget.rb +1 -1
- data/lib/bibliothecary/parsers/pypi.rb +27 -2
- data/lib/bibliothecary/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8220f939e62ba68f9f9edebda8c1d5901d88f028c9caea6b173c2f9da14cb5b4
|
4
|
+
data.tar.gz: 2920b4cf85f4497bf1a2749e8c6c6b2cdfa5c0c0a9f3cb244bc86c7991041974
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 768d17a2954b4ccb4cad09da85074ef4958193fc10aea00cf33cbc8f7a309dc4d2b287a9d71e6b509b1861ddad06b0ad0508818fcd093147214cd836edd5cdf2
|
7
|
+
data.tar.gz: 4d345a0068501420508694bd5491de0584517e60021ff16e216486bc8329a1c5c7655c40df33a631e280c9977f8721d4b9a572f84f60fd6cf9e449134762b768
|
data/.circleci/config.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -13,6 +13,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
13
13
|
|
14
14
|
### Removed
|
15
15
|
|
16
|
+
## [14.1.0] - 2025-10-01
|
17
|
+
|
18
|
+
### Added
|
19
|
+
|
20
|
+
### Changed
|
21
|
+
|
22
|
+
- Dependencies from pom.xml without a scope will not return a "type" of nil instead of guessing "runtime".
|
23
|
+
|
24
|
+
### Removed
|
25
|
+
|
26
|
+
## [14.0.2] - 2025-07-29
|
27
|
+
|
28
|
+
### Added
|
29
|
+
|
30
|
+
- Add support in Pypi parser for PEP-751's newly official "pylock.toml" lockfile
|
31
|
+
|
32
|
+
### Changed
|
33
|
+
|
34
|
+
- Added a regression test to ensure "file" entries in Pipfile/Pipfile.lock are considered local.
|
35
|
+
|
36
|
+
### Removed
|
37
|
+
|
16
38
|
## [14.0.1] - 2025-07-24
|
17
39
|
|
18
40
|
### Changed
|
@@ -9,7 +9,8 @@ module Bibliothecary
|
|
9
9
|
# it's implicit in most parser results, and the analyzer returns the platform name itself. One
|
10
10
|
# exception are multi-parsers like DependenciesCSV, because they may return deps from multiple platforms.
|
11
11
|
# Bibliothecary could start returning this field for *all* deps in future, and make it required. (default: nil)
|
12
|
-
# @attr_reader [String] type The type of dependency, e.g. "runtime" or "test"
|
12
|
+
# @attr_reader [String] type The type or scope of dependency, e.g. "runtime" or "test". In some ecosystems a
|
13
|
+
# default may be set and in other ecosystems it may make sense to return nil when not found.
|
13
14
|
# @attr_reader [Boolean] direct Is this dependency a direct dependency (vs transitive dependency)? (default: nil)
|
14
15
|
# @attr_reader [Boolean] deprecated Is this dependency deprecated? (default: nil)
|
15
16
|
# @attr_reader [Boolean] local Is this dependency local? (default: nil)
|
@@ -12,8 +12,8 @@ module Bibliothecary
|
|
12
12
|
include Bibliothecary::Analyser
|
13
13
|
|
14
14
|
# Matches digraph contents from the Maven dependency tree .dot file format.
|
15
|
-
MAVEN_DOT_PROJECT_REGEXP = /digraph\s+"([
|
16
|
-
MAVEN_DOT_RELATIONSHIP_REGEXP = /"([
|
15
|
+
MAVEN_DOT_PROJECT_REGEXP = /digraph\s+"([^"]+)"\s+{/
|
16
|
+
MAVEN_DOT_RELATIONSHIP_REGEXP = /"([^"]+)"\s+->\s+"([^"]+)"/
|
17
17
|
|
18
18
|
# e.g. "annotationProcessor - Annotation processors and their dependencies for source set 'main'."
|
19
19
|
GRADLE_TYPE_REGEXP = /^(\w+)/
|
@@ -286,7 +286,7 @@ module Bibliothecary
|
|
286
286
|
.encode(universal_newline: true)
|
287
287
|
# capture two groups; one is the ASCII art telling us the tree depth,
|
288
288
|
# and two is the actual dependency
|
289
|
-
.scan(/^\[INFO\]\s((?:[-+|\\]|\s)*)((?:[\w
|
289
|
+
.scan(/^\[INFO\]\s((?:[-+|\\]|\s)*)((?:[\w.-]+:)+[\w.\-${}]+)/)
|
290
290
|
# lines that start with "-" aren't part of the tree, example: "[INFO] --- dependency:3.8.1:tree"
|
291
291
|
.reject { |(tree_ascii_art, _dep_info)| tree_ascii_art.start_with?("-") }
|
292
292
|
.map do |(tree_ascii_art, dep_info)|
|
@@ -491,7 +491,6 @@ module Bibliothecary
|
|
491
491
|
dep_hash[:type] ||= dependency_management[:scope]
|
492
492
|
end
|
493
493
|
|
494
|
-
dep_hash[:type] ||= "runtime"
|
495
494
|
dep_hash[:source] = source
|
496
495
|
end
|
497
496
|
|
@@ -189,7 +189,7 @@ module Bibliothecary
|
|
189
189
|
|
190
190
|
def self.parse_paket_lock(file_contents, options: {})
|
191
191
|
lines = file_contents.split("\n")
|
192
|
-
package_version_re = /\s+(?<name>\S+)\s\((?<version>\d+\.\d+[
|
192
|
+
package_version_re = /\s+(?<name>\S+)\s\((?<version>\d+\.\d+[.\d+[.\d+]*]*)\)/
|
193
193
|
packages = lines.select { |line| package_version_re.match(line) }.map { |line| package_version_re.match(line) }.map do |match|
|
194
194
|
Dependency.new(
|
195
195
|
name: match[:name].strip,
|
@@ -10,7 +10,7 @@ module Bibliothecary
|
|
10
10
|
# Capture Group 1 is package.
|
11
11
|
# Optional Group 2 is [extras].
|
12
12
|
# Capture Group 3 is Version
|
13
|
-
REQUIRE_REGEXP = /([a-zA-Z0-9]+[a-zA-Z0-9\-_
|
13
|
+
REQUIRE_REGEXP = /([a-zA-Z0-9]+[a-zA-Z0-9\-_.]+)(?:\[.*?\])*([><=\w.,]+)?/
|
14
14
|
REQUIREMENTS_REGEXP = /^#{REQUIRE_REGEXP}/
|
15
15
|
|
16
16
|
MANIFEST_REGEXP = /.*require[^\/]*\.(txt|pip|in)$/
|
@@ -20,6 +20,10 @@ module Bibliothecary
|
|
20
20
|
# Adapted from https://peps.python.org/pep-0508/#names
|
21
21
|
PEP_508_NAME_REGEXP = /^([A-Z0-9][A-Z0-9._-]*[A-Z0-9]|[A-Z0-9])/i
|
22
22
|
|
23
|
+
# A modified version of the regexp from the docs, to catch all cases:
|
24
|
+
# https://packaging.python.org/en/latest/specifications/pylock-toml/
|
25
|
+
PEP_751_LOCKFILE_REGEXP = /^pylock(\.[^.]+)?\.toml$/
|
26
|
+
|
23
27
|
def self.mapping
|
24
28
|
{
|
25
29
|
match_filenames("requirements-dev.txt", "requirements/dev.txt",
|
@@ -72,6 +76,11 @@ module Bibliothecary
|
|
72
76
|
kind: "lockfile",
|
73
77
|
parser: :parse_poetry_lock,
|
74
78
|
},
|
79
|
+
# PEP-751: official python lockfile format (https://peps.python.org/pep-0751/)
|
80
|
+
->(p) { PEP_751_LOCKFILE_REGEXP.match(p) } => {
|
81
|
+
kind: "lockfile",
|
82
|
+
parser: :parser_pylock,
|
83
|
+
},
|
75
84
|
}
|
76
85
|
end
|
77
86
|
|
@@ -79,6 +88,22 @@ module Bibliothecary
|
|
79
88
|
add_multi_parser(Bibliothecary::MultiParsers::DependenciesCSV)
|
80
89
|
add_multi_parser(Bibliothecary::MultiParsers::Spdx)
|
81
90
|
|
91
|
+
def self.parser_pylock(file_contents, options: {})
|
92
|
+
lockfile = Tomlrb.parse(file_contents)
|
93
|
+
dependencies = lockfile["packages"].map do |d|
|
94
|
+
is_local = true if d.key?("archive") || d.key?("directory")
|
95
|
+
Dependency.new(
|
96
|
+
platform: platform_name,
|
97
|
+
name: d["name"],
|
98
|
+
type: "runtime",
|
99
|
+
source: options.fetch(:filename, nil),
|
100
|
+
requirement: d["version"] || "*",
|
101
|
+
local: is_local
|
102
|
+
)
|
103
|
+
end
|
104
|
+
ParserResult.new(dependencies: dependencies)
|
105
|
+
end
|
106
|
+
|
82
107
|
def self.parse_pipfile(file_contents, options: {})
|
83
108
|
manifest = Tomlrb.parse(file_contents)
|
84
109
|
dependencies = map_dependencies(manifest["packages"], "runtime", options.fetch(:filename, nil)) +
|
@@ -307,7 +332,7 @@ module Bibliothecary
|
|
307
332
|
uri = URI.parse(url)
|
308
333
|
raise NoEggSpecified, "No egg specified in #{url}" unless uri.fragment
|
309
334
|
|
310
|
-
name = uri.fragment[/^egg=([^&]+)(
|
335
|
+
name = uri.fragment[/^egg=([^&]+)(&|$)/, 1]
|
311
336
|
raise NoEggSpecified, "No egg specified in #{url}" unless name
|
312
337
|
|
313
338
|
requirement = uri.path[/@(.+)$/, 1]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bibliothecary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 14.0
|
4
|
+
version: 14.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Nesbitt
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-10-01 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: commander
|