[neon-notifications] Changes in repo-metadata
Neon CI
noreply at kde.org
Fri May 3 19:46:34 BST 2024
commit 716e414f3a4eaf51f7cfb5acad96730fe4e1de25
Author: Andrew Shark <ashark at linuxcomp.ru>
Date: Fri May 3 03:23:03 2024 +0300
CI: check for pep8 compliance
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 43a6533b..40e274af 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -32,3 +32,11 @@ lint:
- mypy --strict --ignore-missing-imports dependencies/tools/build_order
- mypy --strict dependencies/tools/list_dependencies
- mypy --strict dependencies/tools/list_preferred_repo_branch
+
+autopep8:
+ extends: .python
+ script:
+ - pip3 install autopep8
+ - autopep8 --ignore E501 --exit-code --diff dependencies/tools/build_order
+ - autopep8 --ignore E501 --exit-code --diff dependencies/tools/list_dependencies
+ - autopep8 --ignore E501 --exit-code --diff dependencies/tools/list_preferred_repo_branch
commit 987911a388a872a2bc9ddc8fe67bc80ffa73c4c0
Author: Andrew Shark <ashark at linuxcomp.ru>
Date: Sun Mar 31 01:34:27 2024 +0300
Reformat python code in dependencies/tools
diff --git a/dependencies/tools/build_order b/dependencies/tools/build_order
index 38b7c8c4..d63a71c4 100755
--- a/dependencies/tools/build_order
+++ b/dependencies/tools/build_order
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
-#
+
# Tool to provide a valid build order from a dependency file
#
# See also: http://community.kde.org/Infrastructure/Project_Metadata
-#
+
# Copyright (c) 2016 Albert Astals Cid <aacid at kde.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -30,7 +30,7 @@
import re
import sys
import networkx as nx
-#import matplotlib.pyplot as plt
+# import matplotlib.pyplot as plt
G = nx.DiGraph()
@@ -54,13 +54,13 @@ with open(sys.argv[1], encoding="utf-8") as f:
dependency = match.group(2).strip()
if "*" in item:
- pair = [ item, dependency ]
+ pair = [item, dependency]
greedy_rules.append(pair)
continue
if dependency.startswith("-"):
- dependency = dependency [1:]
- pair = [ item, dependency ]
+ dependency = dependency[1:]
+ pair = [item, dependency]
negative_rules.append(pair)
G.add_edge(item, dependency)
@@ -84,7 +84,6 @@ with open(sys.argv[1], encoding="utf-8") as f:
if node == item:
G.remove_edge(node, negative_dependency)
-
- print (list(reversed(list(nx.topological_sort(G)))))
- #nx.draw(G)
- #plt.show()
+ print(list(reversed(list(nx.topological_sort(G)))))
+ # nx.draw(G)
+ # plt.show()
diff --git a/dependencies/tools/list_dependencies b/dependencies/tools/list_dependencies
index 6232df7c..26e44c3b 100755
--- a/dependencies/tools/list_dependencies
+++ b/dependencies/tools/list_dependencies
@@ -1,10 +1,10 @@
#!/usr/bin/env python3
-#
+
# Tool to read KDE project metadata to determine which modules are required
# (or recommended) to build a given KDE repository.
#
# See also: http://community.kde.org/Infrastructure/Project_Metadata
-#
+
# Copyright (c) 2014 Michael Pyne <mpyne at kde.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -36,12 +36,14 @@ from typing import Dict, KeysView, List, Set, Tuple
version = "0.1"
+
@dataclass
class Node:
node: str
branch: str
children: List["Node"]
+
# Handles all aspects of dependency parsing and ordering.
# This is probably too monolithic though -- feel free to fix!
#
@@ -88,17 +90,19 @@ class Node:
# # other deps for foo[some-other-branch]
# }
# }
+
+
class KDEDependencies:
def __init__(self, fileName: str) -> None:
self.memoizedDependencies: Dict[str, Node] = {}
self.wildcardDependencies: Dict[str, str] = {}
- self.dependencies, self.negativeDeps, self.wildcardItems \
- = self.importDependencies(fileName)
- self.implicitDependencies: Dict[str, str] = self.dependencies.get('*', {}).get('*', {})
+ self.dependencies, self.negativeDeps, self.wildcardItems = self.importDependencies(fileName)
+ self.implicitDependencies: Dict[str, str] = self.dependencies.get("*", {}).get("*", {})
self.showDirectOnly = False
def setShowDirectOnly(self, showDirectOnly: bool) -> None:
- """Whether or not to show all dependencies recursively, or only direct
+ """
+ Whether to show all dependencies recursively, or only direct
dependencies. Note: I wasn't able to implement correct ordering if
direct dependencies only are shown. It turns out to be quite nuanced too
so be careful if you fix this yourself, as getting the ordering right
@@ -116,23 +120,23 @@ class KDEDependencies:
negativeDeps: Dict[str, Dict[str, Dict[str, str]]] = {}
wildcardItems: Set[str] = set()
- with open(fileName, 'r', encoding="utf-8") as file:
+ with open(fileName, "r", encoding="utf-8") as file:
for line in file:
- line = line.partition('#')[0].lstrip()
+ line = line.partition("#")[0].lstrip()
if not line:
continue
- lineParts = line.partition(':')
+ lineParts = line.partition(":")
repoItem = lineParts[0].lstrip().rstrip()
dependentItem = lineParts[2].lstrip().rstrip()
repo, repoBranch = self.itemToPathAndBranch(repoItem)
- if repo.endswith('/*'):
- wildcardItems.add(repo.rstrip('/*'))
+ if repo.endswith("/*"):
+ wildcardItems.add(repo.rstrip("/*"))
negativeDep = False
- if dependentItem.startswith('-'):
+ if dependentItem.startswith("-"):
negativeDep = True
- dependentItem = dependentItem.lstrip('-')
+ dependentItem = dependentItem.lstrip("-")
dependency, dependencyBranch = self.itemToPathAndBranch(dependentItem)
dictRepoItem = None
@@ -146,28 +150,29 @@ class KDEDependencies:
# Verify same branch
curBranchDep = dictBranchItem[dependency]
if curBranchDep != dependencyBranch:
- msg = f'{repo}:{repoBranch} depends on {dependency} and two of its branches, {dependencyBranch} and {curBranchDep}'
+ msg = f"{repo}:{repoBranch} depends on {dependency} and two of its branches, {dependencyBranch} and {curBranchDep}"
raise RuntimeError(msg)
dictBranchItem[dependency] = dependencyBranch
return dependencies, negativeDeps, wildcardItems
- def itemToPathAndBranch(self, item: str) -> Tuple[str, str]:
+ @staticmethod
+ def itemToPathAndBranch(item: str) -> Tuple[str, str]:
"""Splits a foo[foo-branch] dependency into its item and branch pairs"""
# Look for match everything up to [, then [,
# then match to end of line and find the last ]
- result = re.search(r'(^[^\[]*)[\[](.*)]$', item)
+ result = re.search(r"(^[^\[]*)[\[](.*)]$", item)
if result:
return result.group(1), result.group(2)
- return item, '*' # No branch, use wildcard
+ return item, "*" # No branch, use wildcard
- def keyFromModuleBranch(self, module: str, branch: str) -> Tuple[str, str]:
+ @staticmethod
+ def keyFromModuleBranch(module: str, branch: str) -> Tuple[str, str]:
"""Merges module and branch into a single item for storage"""
- return (module, branch)
+ return module, branch
- #
# For the following functions, we keep track of a concept of "dependency
# candidates" due to the negative dependencies and wildcards. Basically we
# add all possible implicit and wildcard dependencies for a module (using
@@ -175,7 +180,6 @@ class KDEDependencies:
# about the branch we're using), and then remove negative dependencies
# (again, ones that are branch-independent and ones that match branches
# present in the list).
- #
def _addModuleBranchDirectDependencies(self, depCandidates: List[Tuple[str, str]], module: str, branch: str) -> None:
if module not in self.dependencies or branch not in self.dependencies[module]:
@@ -187,13 +191,11 @@ class KDEDependencies:
if newKey not in depCandidates:
depCandidates.append(newKey)
- def _removeModuleBranchNegativeDependencies(
- self, depCandidates: List[Tuple[str, str]], module: str, branch: str
- ) -> None:
+ def _removeModuleBranchNegativeDependencies(self, depCandidates: List[Tuple[str, str]], module: str, branch: str) -> None:
if module not in self.negativeDeps or branch not in self.negativeDeps[module]:
return
for depModule, depBranch in self.negativeDeps[module][branch].items():
- if depModule == '*':
+ if depModule == "*":
# The [:] is just to ensure we're assigning to the list passed
# in to make depCandidates a mutable parameter, otherwise it
# would only be a local effect.
@@ -202,23 +204,25 @@ class KDEDependencies:
key = self.keyFromModuleBranch(depModule, depBranch)
depCandidates[:] = [x for x in depCandidates if x != key]
- # Adds all effective dependencies of the given module/branch, storing
- # the result as a tree under node. To be useful the tree of node and its
- # children must still be processed to get the list of dependencies.
def _addEffectiveDeps(self, node: Node, module: str, branch: str) -> None:
+ """
+ Adds all effective dependencies of the given module/branch, storing
+ the result as a tree under node. To be useful the tree of node and its
+ children must still be processed to get the list of dependencies.
+ """
depCandidates: List[Tuple[str, str]] = []
for w in self.wildcardItems:
- if not module.endswith('/*') and module.startswith(w + '/'):
+ if not module.endswith("/*") and module.startswith(w + "/"):
wildcardRepo = w + "/*"
- self._addModuleBranchDirectDependencies(depCandidates, wildcardRepo, '*')
+ self._addModuleBranchDirectDependencies(depCandidates, wildcardRepo, "*")
if module not in self.implicitDependencies:
for depModule, depBranch in self.implicitDependencies.items():
depCandidates.append(self.keyFromModuleBranch(depModule, depBranch))
- self._addModuleBranchDirectDependencies(depCandidates, module, '*')
+ self._addModuleBranchDirectDependencies(depCandidates, module, "*")
self._addModuleBranchDirectDependencies(depCandidates, module, branch)
- self._removeModuleBranchNegativeDependencies(depCandidates, module, '*')
+ self._removeModuleBranchNegativeDependencies(depCandidates, module, "*")
self._removeModuleBranchNegativeDependencies(depCandidates, module, branch)
# Don't let modules depend on themselves by accident
@@ -230,10 +234,12 @@ class KDEDependencies:
newNode = self._findDepsInternal(depModule, depBranch)
node.children.append(newNode)
- # Finds all dependencies recursively for the given module and branch,
- # returns a "node" structure (which is itself a tree) describing the
- # dependencies and their proper order.
def _findDepsInternal(self, module: str, branch: str) -> Node:
+ """
+ Finds all dependencies recursively for the given module and branch,
+ returns a "node" structure (which is itself a tree) describing the
+ dependencies and their proper order.
+ """
node = self.memoizedDependencies.get(module, None)
if not node:
node = Node(module, branch, [])
@@ -246,13 +252,14 @@ class KDEDependencies:
return node
- def printTree(self, node: Node, level: int=0) -> None:
- """Takes the "node" as returned from _findDepsInternal and pretty prints
+ def printTree(self, node: Node, level: int = 0) -> None:
+ """
+ Takes the "node" as returned from _findDepsInternal and pretty prints
a tree version of the dependencies, without removing common deps.
"""
branch = node.branch
- spacing = ' '.ljust(level)
- if branch != '*':
+ spacing = " ".ljust(level)
+ if branch != "*":
print(f"{spacing}{node.node}[{branch}]")
else:
print(f"{spacing}{node.node}")
@@ -260,17 +267,20 @@ class KDEDependencies:
for child in node.children:
self.printTree(child, level + 2)
- def printableModuleBranch(self, module: str, branch: str) -> str:
- """Prints a module/branch combination, showing the branch only if it was
+ @staticmethod
+ def printableModuleBranch(module: str, branch: str) -> str:
+ """
+ Prints a module/branch combination, showing the branch only if it was
actually set or otherwise mentioned (most dependencies are
branch-independent).
"""
- if branch != '*':
+ if branch != "*":
return f"{module}[{branch}]"
return module
def printOrdering(self, node: Node, visitedSet: Set[str]) -> None:
- """Takes a "node" returned by _findDepsInternal and prints all of the
+ """
+ Takes a "node" returned by _findDepsInternal and prints all the
dependencies in pre-order fashion. Dependency items are only printed
once, the first time they are encountered.
"""
@@ -296,7 +306,7 @@ class KDEDependencies:
else:
# Fake supporting multiple module paths by merging into virtual dependent
rootModule = "*"
- self.dependencies[rootModule] = { "*": { x : branch for x in modules } }
+ self.dependencies[rootModule] = {"*": {x: branch for x in modules}}
node = self._findDepsInternal(rootModule, branch)
visitSet: Set[str] = set()
@@ -311,10 +321,10 @@ class KDEDependencies:
"""Return an iterator over all module names."""
return self.dependencies.keys()
-def addPathIfMissing(
- deps: KDEDependencies, modules: List[str], ignore_missing: bool = False
-) -> Tuple[List[str], List[str]]:
- """Partition a list of modules into good and bad modules
+
+def addPathIfMissing(deps: KDEDependencies, modules: List[str], ignore_missing: bool = False) -> Tuple[List[str], List[str]]:
+ """
+ Partition a list of modules into good and bad modules
The good modules will be expanded to the full path (if they are not already
the full path) by finding the first module in the list of dependencies where
@@ -328,7 +338,7 @@ def addPathIfMissing(
elif "/" not in m:
found = False
for mod in deps.allModules():
- if mod.endswith("/"+m):
+ if mod.endswith("/" + m):
good.append(mod)
found = True
break
@@ -341,35 +351,35 @@ def addPathIfMissing(
else:
bad.append(m)
- return (good, bad)
+ return good, bad
+
def main() -> None:
"""The main function of this script"""
- arg_parser = argparse.ArgumentParser(
- description="Shows the git.kde.org dependencies of git.kde.org modules.")
+
+ arg_parser = argparse.ArgumentParser(description="Shows the git.kde.org dependencies of git.kde.org modules.")
arg_parser.add_argument("-d", "--direct-dependencies", action="store_true",
- help="Shows *unordered* direct dependencies only (default is recursive).")
+ help="Shows *unordered* direct dependencies only (default is recursive).")
arg_parser.add_argument("-g", "--branch-group", default="kf5-qt5",
- help="Branch group to use for dependencies (stable-qt4, latest-qt4, or kf5-qt5)")
+ help="Branch group to use for dependencies (stable-qt4, latest-qt4, or kf5-qt5)")
arg_parser.add_argument("-b", "--branch", default="*",
- help="Specific repository branch to find dependencies of (prefer --branch-group though). Default is '*'")
+ help="Specific repository branch to find dependencies of (prefer --branch-group though). Default is '*'")
arg_parser.add_argument("module_path",
- nargs="+",
- help=
- """KDE project module path e.g. kde/kdelibs. If multiple paths are
- specified (with the -d option), they have their branches printed
- one-per-line in the order listed. Without the -d option, dependencies
- are shown recursively, and in the needed build order, *including* the
- module paths passed in on the command line.
- """
- )
+ nargs="+",
+ help="""KDE project module path e.g. kde/kdelibs. If multiple paths are
+ specified (with the -d option), they have their branches printed
+ one-per-line in the order listed. Without the -d option, dependencies
+ are shown recursively, and in the needed build order, *including* the
+ module paths passed in on the command line.
+ """
+ )
arg_parser.add_argument("-m", "--metadata-path",
- default="../",
- help="Path to kde-build-metadata *directory*")
- arg_parser.add_argument("-f", "--assume-present", action='store_true',
- help="If set, assume all input modules are present, and list implicit dependencies")
+ default="../",
+ help="Path to kde-build-metadata *directory*")
+ arg_parser.add_argument("-f", "--assume-present", action="store_true",
+ help="If set, assume all input modules are present, and list implicit dependencies")
arg_parser.add_argument("-v", "--version",
- action='version', version='%(prog)s ' + str(version))
+ action="version", version="%(prog)s " + str(version))
args = arg_parser.parse_args()
deps = KDEDependencies(f"{args.metadata_path}/dependency-data-{args.branch_group}")
@@ -384,5 +394,6 @@ def main() -> None:
else:
deps.findDependenciesOf(modules, args.branch)
-if __name__ == '__main__':
+
+if __name__ == "__main__":
main()
diff --git a/dependencies/tools/list_preferred_repo_branch b/dependencies/tools/list_preferred_repo_branch
index d1ab8544..02c33c64 100755
--- a/dependencies/tools/list_preferred_repo_branch
+++ b/dependencies/tools/list_preferred_repo_branch
@@ -1,11 +1,11 @@
#!/usr/bin/env python3
-#
+
# Tool to process KDE project metadata describing which git branch to build for
# the various KDE git repositories, in order to get the desired development
# branch.
#
# See also: http://community.kde.org/Infrastructure/Project_Metadata
-#
+
# Copyright (c) 2013, 2015 Michael Pyne <mpyne at kde.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -40,9 +40,9 @@ version = "0.2"
class LogicalModuleStructure(BaseModel):
- """The logical module structure.
- It is documented at
- http://community.kde.org/Infrastructure/Project_Metadata#kde-build-metadata
+ """
+ The logical module structure.
+ It is documented at https://community.kde.org/Infrastructure/Project_Metadata#kde-build-metadata
"""
version: int
@@ -60,11 +60,12 @@ class LogicalGroups:
# also for ease of searching, and count path separators so that we don't
# accidentally match something like kde/kdelibs to kde/kdelibs/*
self.catch_alls = [(group, group[:group.rfind("*", 0)], group.count("/"))
- for group in self.logical_groups
- if group.endswith("*")]
- self.catch_alls.sort(key=lambda x:x[1], reverse=True)
+ for group in self.logical_groups
+ if group.endswith("*")]
+ self.catch_alls.sort(key=lambda x: x[1], reverse=True)
- def importLogicalGroups(self, fileName: str) -> LogicalModuleStructure:
+ @staticmethod
+ def importLogicalGroups(fileName: str) -> LogicalModuleStructure:
"""Load the logical module structure from a JSON file"""
with open(fileName, "r", encoding="utf-8") as file:
lms_json = json.load(file)
@@ -88,10 +89,10 @@ class LogicalGroups:
# longest common-prefix with our module path.
module_path_comps = module.count("/") + 1
search_gen = (group_spec[0] for group_spec in self.catch_alls
- if group_spec[2] < module_path_comps and
- (module.startswith(group_spec[1]) or
- group_spec[1] == "")) # This would always be from a
- # '*' entry, which would be last
+ if group_spec[2] < module_path_comps and
+ (module.startswith(group_spec[1]) or
+ group_spec[1] == "")) # This would always be from a
+ # '*' entry, which would be last
# We use next to avoid searching the whole list when we just want
# the first match. Due to the way we sorted self.catch_alls the
@@ -103,24 +104,25 @@ class LogicalGroups:
return None
+
def main() -> None:
"""The main function of this script"""
arg_parser = argparse.ArgumentParser(
- description="Maps git.kde.org modules and logical groups to git branches. " +
- "If no branch is configured for a given module path, a string containing <nothing set> " +
- "is returned, which should be converted into a default git branch, such as master")
+ description="Maps git.kde.org modules and logical groups to git branches. " +
+ "If no branch is configured for a given module path, a string containing <nothing set> " +
+ "is returned, which should be converted into a default git branch, such as master")
arg_parser.add_argument("logical_group",
- help="Logical group to find branch from e.g. stable-qt4, latest-qt4, or kf5-qt5")
+ help="Logical group to find branch from e.g. stable-qt4, latest-qt4, or kf5-qt5")
arg_parser.add_argument("module_path", nargs="+",
- help="KDE project module path e.g. kde/kdelibs. If multiple paths are " +
- "specified, they have their branches printed one-per-line in the order listed")
+ help="KDE project module path e.g. kde/kdelibs. If multiple paths are " +
+ "specified, they have their branches printed one-per-line in the order listed")
arg_parser.add_argument("-f", "--metadata-file",
- default="../logical-module-structure.json",
- help="Path to logical-module-structure file (default: %(default)s)")
+ default="../logical-module-structure.json",
+ help="Path to logical-module-structure file (default: %(default)s)")
arg_parser.add_argument("-v", "--version",
- action='version', version='%(prog)s ' + str(version))
+ action='version', version='%(prog)s ' + str(version))
arg_parser.add_argument("-p", "--print-module-path", action="store_true",
- help="Prints the module path before the branch (useful when multiple modules passed)")
+ help="Prints the module path before the branch (useful when multiple modules passed)")
args = arg_parser.parse_args()
json_groups = LogicalGroups(args.metadata_file)
@@ -136,12 +138,13 @@ def main() -> None:
branch = "<not in that branch-group>"
if args.print_module_path:
- print (f"{module_path}: {branch}")
+ print(f"{module_path}: {branch}")
else:
- print (branch)
+ print(branch)
except KeyError as k:
- sys.stderr.write (f"An error occurred: {k}\n")
+ sys.stderr.write(f"An error occurred: {k}\n")
sys.exit(1)
-if __name__ == '__main__':
+
+if __name__ == "__main__":
main()
commit 9298b482f4c8d061a516274ff92121b913002efe
Author: Arsen Arsenović <arsen at aarsen.me>
Date: Tue Apr 30 15:31:19 2024 +0200
Update gentoo.ini following dev-build category creation
We've recently added the dev-build category and moved some packages into
it. Renaming here accordingly.
diff --git a/distro-dependencies/gentoo.ini b/distro-dependencies/gentoo.ini
index bd182621..00a73239 100644
--- a/distro-dependencies/gentoo.ini
+++ b/distro-dependencies/gentoo.ini
@@ -1,4 +1,7 @@
[pkg/gentoo/unknown]
+dev-build/cmake
+dev-build/meson
+dev-build/ninja
dev-libs/icu
dev-libs/libdbusmenu-qt
dev-qt/designer:5
@@ -23,10 +26,7 @@ dev-qt/qttest:5
dev-qt/qtwidgets:5
dev-qt/qtx11extras:5
dev-qt/qtxml:5
-dev-util/cmake
dev-util/gperf
-dev-util/meson
-dev-util/ninja
dev-vcs/git
sys-devel/clang
virtual/libintl
More information about the neon-notifications
mailing list