mirror of
https://github.com/vacp2p/nim-libp2p.git
synced 2025-03-01 16:40:32 +00:00
wip
This commit is contained in:
parent
e0f70b7177
commit
9e5c335b8a
14
.github/workflows/maxver.yml
vendored
Normal file
14
.github/workflows/maxver.yml
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
name: Daily (maxver)
|
||||||
|
on:
|
||||||
|
# schedule:
|
||||||
|
# - cron: "0 6 * * *"
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- maxver-minver
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
call-multi-nim-common:
|
||||||
|
uses: ./.github/workflows/daily_common.yml
|
||||||
|
with:
|
||||||
|
nim-branch: "['version-1-6', 'devel']"
|
||||||
|
cpu: "['i386']"
|
0
.github/workflows/minver.yml
vendored
Normal file
0
.github/workflows/minver.yml
vendored
Normal file
11
asd.min
Normal file
11
asd.min
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
nim==1.6.0
|
||||||
|
nimcrypto==0.4.1
|
||||||
|
dnsclient==0.3.0
|
||||||
|
bearssl==0.1.4
|
||||||
|
chronicles==0.10.2
|
||||||
|
chronos==3.0.6
|
||||||
|
metrics
|
||||||
|
secp256k1
|
||||||
|
stew#head
|
||||||
|
websock
|
||||||
|
unittest2
|
59
scripts/build_libp2p_minver.py
Normal file
59
scripts/build_libp2p_minver.py
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
import re
|
||||||
|
from itertools import groupby
|
||||||
|
|
||||||
|
requires_pattern = r"(?P<requires>requires *)(?P<dependencies>(?P<dependecy>(?P<specification>\".*\")(?P<separators>,? *\n? *))*)"
|
||||||
|
file_path: str = "libp2p.nimble"
|
||||||
|
|
||||||
|
|
||||||
|
def get_dependencies_group(path: str) -> str:
|
||||||
|
with open(path, "r") as file:
|
||||||
|
match = re.search(requires_pattern, file.read())
|
||||||
|
return match.group("dependencies")
|
||||||
|
|
||||||
|
|
||||||
|
def parse_group(_group: str) -> list[str]:
|
||||||
|
return _group.replace(" ", "").replace("\n", "").split(",")
|
||||||
|
|
||||||
|
|
||||||
|
def clean_dependency(_dependency: str) -> str:
|
||||||
|
return _dependency.replace("\"", "")
|
||||||
|
|
||||||
|
|
||||||
|
# Nimble symbols: <, <=, >, >=, ==, ~=, ^=, #
|
||||||
|
eq_symbols = ("#", "==")
|
||||||
|
def contains_eq_symbol(_dependency: str) -> bool:
|
||||||
|
return any((eq_symbol in _dependency for eq_symbol in eq_symbols))
|
||||||
|
|
||||||
|
|
||||||
|
def classify_dependency(_dependency: str) -> str:
|
||||||
|
if contains_eq_symbol(_dependency):
|
||||||
|
return "eq"
|
||||||
|
elif ">" in _dependency:
|
||||||
|
return "gt"
|
||||||
|
else:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
def classify_dependencies(_dependencies: list[str]) -> dict[str, list[str]]:
|
||||||
|
d = {
|
||||||
|
"eq": [],
|
||||||
|
"gt": [],
|
||||||
|
"": [],
|
||||||
|
}
|
||||||
|
for _dependency in _dependencies:
|
||||||
|
d[classify_dependency(_dependency)].append(_dependency)
|
||||||
|
return d
|
||||||
|
|
||||||
|
|
||||||
|
def parse_versions(_classified_dependencies: dict[str, list[str]]):
|
||||||
|
eq, gt, nothing = _classified_dependencies["eq"], _classified_dependencies["gt"], _classified_dependencies[""]
|
||||||
|
eq = [re.sub(r"#", "", eq_) for eq_ in eq]
|
||||||
|
print(eq)
|
||||||
|
|
||||||
|
|
||||||
|
dependencies_group: str = get_dependencies_group(file_path)
|
||||||
|
dependencies: list[str] = [clean_dependency(dependency) for dependency in parse_group(dependencies_group)]
|
||||||
|
classified_dependencies: dict[str, list[str]] = classify_dependencies(dependencies)
|
||||||
|
asd = parse_versions(classified_dependencies) # No classifier needed, just replace >= with ==, and remove second part if there is
|
||||||
|
|
||||||
|
print(asd)
|
34
scripts/build_libp2p_minver.sh
Executable file
34
scripts/build_libp2p_minver.sh
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
requires_pattern="requires *(((\".*\")(,? *\n? *))*)"
|
||||||
|
file_path="libp2p.nimble"
|
||||||
|
|
||||||
|
get_dependencies_group() {
|
||||||
|
dependencies=$(grep -Pzo "$requires_pattern" $1 | tr -d '\0')
|
||||||
|
dependencies=$(sed 's/.*requires *//p' <<< "$dependencies")
|
||||||
|
echo $dependencies
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_group() {
|
||||||
|
group=$(echo $1 | tr -d ' ' | tr -d '\n' | tr ',' ' ' | tr -d '\0')
|
||||||
|
echo $group
|
||||||
|
}
|
||||||
|
|
||||||
|
clean_dependency() {
|
||||||
|
dependency=$(echo $1 | tr -d '"')
|
||||||
|
echo $dependency
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies_group=$(get_dependencies_group $file_path)
|
||||||
|
dependencies=$(parse_group "$dependencies_group")
|
||||||
|
var=()
|
||||||
|
for dependency in $dependencies; do
|
||||||
|
var+=($(clean_dependency $dependency))
|
||||||
|
done
|
||||||
|
|
||||||
|
# print all elements in var
|
||||||
|
#
|
||||||
|
for i in "${var[@]}"; do
|
||||||
|
echo "'"$i"'"
|
||||||
|
done
|
||||||
|
# echo "${var[@]}"
|
Loading…
x
Reference in New Issue
Block a user