diff --git a/ognibuild/__main__.py b/ognibuild/__main__.py index 71e3f63..32ebe57 100644 --- a/ognibuild/__main__.py +++ b/ognibuild/__main__.py @@ -19,7 +19,7 @@ import logging import os import sys from . import UpstreamPackage -from .buildsystem import NoBuildToolsFound +from .buildsystem import NoBuildToolsFound, detect_buildsystems from .build import run_build from .clean import run_clean from .dist import run_dist diff --git a/ognibuild/buildsystem.py b/ognibuild/buildsystem.py index fa070e3..63c62bd 100644 --- a/ognibuild/buildsystem.py +++ b/ognibuild/buildsystem.py @@ -413,7 +413,7 @@ class Cargo(BuildSystem): name = 'cargo' def __init__(self, path): - from toml.decoder import load, TomlDecodeError + from toml.decoder import load with open(path, 'r') as f: self.cargo = load(f) @@ -505,7 +505,6 @@ def detect_buildsystems(path): cabal_filenames) if os.path.exists(os.path.join(path, '.travis.yml')): - import yaml import ruamel.yaml.reader with open('.travis.yml', 'rb') as f: try: diff --git a/ognibuild/debian/fix_build.py b/ognibuild/debian/fix_build.py index a5ef5ae..211d452 100644 --- a/ognibuild/debian/fix_build.py +++ b/ognibuild/debian/fix_build.py @@ -24,15 +24,17 @@ import os import re import subprocess import sys -from typing import Iterator, List, Callable, Type, Tuple, Set +from typing import Iterator, List, Callable, Type, Tuple, Set, Optional from debian.deb822 import ( Deb822, PkgRelation, Release, -) + ) +from debian.changelog import Version from breezy.commit import PointlessCommit +from breezy.mutabletree import MutableTree from breezy.tree import Tree from debmutate.control import ( ensure_some_version, @@ -122,13 +124,18 @@ class CircularDependency(Exception): class DependencyContext(object): - def __init__(self, tree, subpath="", committer=None, update_changelog=True): + + def __init__(self, tree: MutableTree, + subpath: str = '', committer: Optional[str] = None, + update_changelog: bool = True): self.tree = tree self.subpath = subpath self.committer = committer self.update_changelog = update_changelog - def add_dependency(self, package, minimum_version=None): + def add_dependency( + self, package: str, + minimum_version: Optional[Version] = None) -> bool: raise NotImplementedError(self.add_dependency) @@ -266,9 +273,9 @@ def add_test_dependency( ) -def commit_debian_changes( - tree, subpath, summary, committer=None, update_changelog=True -): +def commit_debian_changes(tree: MutableTree, subpath: str, + summary: str, committer: Optional[str] = None, + update_changelog: bool = True) -> bool: with tree.lock_write(): try: if update_changelog: diff --git a/ognibuild/dist.py b/ognibuild/dist.py index 79610d5..57d1cf9 100644 --- a/ognibuild/dist.py +++ b/ognibuild/dist.py @@ -120,7 +120,7 @@ def create_dist_schroot( include_controldir: bool = True, subdir: Optional[str] = None) -> str: from .buildsystem import detect_buildsystems - from .apt import AptResolver + from .resolver import AptResolver if subdir is None: subdir = "package" with SchrootSession(chroot) as session: diff --git a/ognibuild/resolver.py b/ognibuild/resolver.py index dffb263..e663559 100644 --- a/ognibuild/resolver.py +++ b/ognibuild/resolver.py @@ -65,7 +65,7 @@ class AptResolver(Resolver): if req.family == 'python3': yield 'python3-%s' % req.name else: - path = list(self._possible_paths(req)) + list(self._possible_paths(req)) raise NotImplementedError