From 2916b055cefc169dd971daba81a6732b0928890f Mon Sep 17 00:00:00 2001 From: Chetan Vardhan Date: Fri, 8 Mar 2024 05:05:07 +0530 Subject: [PATCH] Refactor tag search, some minor development --- src/PerfChecker.jl | 22 +--------------------- src/versions.jl | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 21 deletions(-) create mode 100644 src/versions.jl diff --git a/src/PerfChecker.jl b/src/PerfChecker.jl index eb827d6..95d7154 100644 --- a/src/PerfChecker.jl +++ b/src/PerfChecker.jl @@ -23,27 +23,7 @@ struct CheckerResult tags::Vector{Symbol} end -function find_by_tags(tags::Vector{Symbol}, results::CheckerResult; exact_match = true) - results = [] - if exact_match - for j in results - if tags == j.tags - push!(results, tags) - else - end - else - for j in results - for i in tags - if i in j.tags - push!(results, tags) - break - end - end - end - end - - return results -end +find_by_tags(tags::Vector{Symbol}, results::CheckerResult; exact_match = true) = findall(x -> exact_match ? (tags == x.tags) : (!isempty(x.tags ∩ tags)), results) # SECTION - Exports export @check diff --git a/src/versions.jl b/src/versions.jl new file mode 100644 index 0000000..bfe28a3 --- /dev/null +++ b/src/versions.jl @@ -0,0 +1,23 @@ +const VerConfig = Tuple{Symbol, Vector{VersionNumber}, Bool} + +struct PackVer + pack::String + ver::VerConfig +end + +to_version_numbers(x) = to_version_numbers(x...) +to_version_numbers(s::Symbol, x...) = to_version_numbers(Val(s), x...) + +function findmaxversion(d::String,m::String) + l=m[1:1] + a_path=joinpath(d,"registries","General",l,m) + if isdir(d)&&isdir(a_path) + di=Pkg.Operations.load_versions(a_path) + return maximum(keys(di)) + end + return v"0.0.0" +end + +findmaxversion(m::String)=maximum(findmaxversion.(DEPOT_PATH,m)) + +function to_version_numbers(ver::VerConfig) end