-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0f70b7
commit 9e5c335
Showing
5 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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']" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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[@]}" |