From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id F17B5138A2F for ; Fri, 15 Aug 2014 22:32:49 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 58BC6E0AD3; Fri, 15 Aug 2014 22:32:44 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D78BEE0ACB for ; Fri, 15 Aug 2014 22:32:41 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id F12DF340605 for ; Fri, 15 Aug 2014 22:32:40 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id D6B211881C for ; Fri, 15 Aug 2014 22:32:37 +0000 (UTC) From: "Devan Franchini" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Devan Franchini" Message-ID: <1408138962.74a5d6e23ea52f4bb2d19d1deb0b9abc36b20f23.twitch153@gentoo> Subject: [gentoo-commits] proj/layman:gsoc2014 commit in: layman/ X-VCS-Repository: proj/layman X-VCS-Files: layman/api.py X-VCS-Directories: layman/ X-VCS-Committer: twitch153 X-VCS-Committer-Name: Devan Franchini X-VCS-Revision: 74a5d6e23ea52f4bb2d19d1deb0b9abc36b20f23 X-VCS-Branch: gsoc2014 Date: Fri, 15 Aug 2014 22:32:37 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: e4e90f1d-547a-412f-ad4f-a7c611d3edcc X-Archives-Hash: 56a822564fe5d28733210aea56c7727f commit: 74a5d6e23ea52f4bb2d19d1deb0b9abc36b20f23 Author: Devan Franchini gentoo org> AuthorDate: Fri Aug 1 04:36:07 2014 +0000 Commit: Devan Franchini gentoo org> CommitDate: Fri Aug 15 21:42:42 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=74a5d6e2 api.py: Makes supported_types() check for modules Prior to executing require_supported() and notifying a user that the overlay type isn't supported due to not finding the proper command bin, a check has been made to see if the overlay module has been brought in by the user. This will prevent unnecessary complaining from layman. --- layman/api.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/layman/api.py b/layman/api.py index 0f43f28..b3f33f6 100755 --- a/layman/api.py +++ b/layman/api.py @@ -624,12 +624,25 @@ class LaymanAPI(object): def supported_types(self): """returns a dictionary of all repository types, with boolean values""" + here = os.path.dirname(os.path.realpath(__file__)) + modpath = os.path.join('overlays', 'modules') + modules = os.path.listdir(os.path.join(here, modpath)) + cmds = [x for x in self.config.keys() if '_command' in x] supported = {} for cmd in cmds: type_key = cmd.split('_')[0] - supported[type_key] = require_supported( - [(self.config[cmd],type_key, '')], self.output.warn) + # The module dir might be named differently from the type_key. + # ex.) g-common and g-sorcery are named g_common and g_sorcery. + module = type_key.replace('-', '_') + + # Don't bother executing require_supported() if the user didn't + # bring in support for the overlay type in the first place. + if module in modules: + supported[type_key] = require_supported( + [(self.config[cmd],type_key, '')], self.output.warn) + else: + supported[type_key] = False return supported