From c73f42c8ba42e34fd552f145e971f32462a96cfa Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Sun, 26 Oct 2014 01:14:28 +0200 Subject: Pull execution out of module scope --- overlint/cli.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/overlint/cli.py b/overlint/cli.py index 2161757..46e3d32 100644 --- a/overlint/cli.py +++ b/overlint/cli.py @@ -3,7 +3,7 @@ from __future__ import print_function -VERSION_STR = '0.5.2' +VERSION_STR = '0.5.3' import sys import os @@ -21,7 +21,10 @@ except ImportError: _revision_matcher = re.compile('-r([0-9]+)$') _ignore_matcher = re.compile('(?:^# (?:\\$Header|Copyright)|KEYWORDS=)') -portdir = portage.settings["PORTDIR"] + +def get_portdir(): + return portage.settings["PORTDIR"] + def find_atoms(repository_path, category_package): versions = list() @@ -113,7 +116,7 @@ def find_ebuild_changes(category_package, overlay_path, gentoo_versions, overlay category, package = category_package.split('/') for version in intersection: ebuild_name = '%s-%s.ebuild' % (package, version) - filename_a = os.path.join(portdir, category_package, ebuild_name) + filename_a = os.path.join(get_portdir(), category_package, ebuild_name) filename_b = os.path.join(overlay_path, category_package, ebuild_name) if ebuilds_are_equivalent(filename_a, filename_b): continue @@ -180,13 +183,13 @@ def main(args): category_package = full_path_overlay[len(conf.overlay_path + '/'):] if len(category_package.split('/')) != 2: continue - full_path_gentoo = os.path.join(portdir, category_package) + full_path_gentoo = os.path.join(get_portdir(), category_package) found = os.path.exists(full_path_gentoo) if not found: continue overlay_versions = find_atoms(conf.overlay_path, category_package) - gentoo_versions = find_atoms(portdir, category_package) + gentoo_versions = find_atoms(get_portdir(), category_package) (missed_revision_bumps, missed_version_bumps) = find_missed_bumps(gentoo_versions, overlay_versions) lagging_behind_gentoo = find_lagging_behind_gentoo(gentoo_versions, overlay_versions) ebuild_changes = find_ebuild_changes(category_package, conf.overlay_path, gentoo_versions, overlay_versions) -- cgit v1.2.3-65-gdbad