#!/usr/bin/python ''' # DESCRIPTION: # Entropy Package Manager client Copyright (C) 2007 Fabio Erculiani This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ''' import sys import string import equoTools import entropyTools from entropyConstants import * from clientConstants import * from outputTools import * # CONSTANTS APPNAME = "equo" APPVERSION = "1.0" def print_help(): print_info("Sabayon Linux "+APPNAME+" (C - 2007)") print_info("General Options:") print_info(" --help\t\tthis output") print_info(" --version\t\tprint version") print_info(" --verbose\t\tbe more verbose") print_info(" --nocolor\t\tdisable colorized output") print_info(blue("Tools available: ")) print_info(" \t"+darkgreen(bold("repo"))+brown("\t\t to handle package repositories")) print_info(" \t\t"+darkgreen("sync")+red("\t\t\t sync repositories")) print_info(" \t\t"+darkgreen("show")+red("\t\t\t show enabled repositories")) print_info(" \t\t"+darkgreen("status")+red("\t\t\t show respositories status")) print_info(" \t"+darkgreen(bold("package"))+brown("\t\t to handle packages")) print_info(" \t\t"+darkgreen("search")+red("\t\t\t to search a package inside the database")) print_info(" \t\t"+darkgreen("install")+red("\t\t\t to install a package")) print_info(" \t\t\t"+red("--ask")+"\t\t ask before making any changes") print_info(" \t\t\t"+red("--pretend")+"\t just show what would be done") print_info(" \t\t\t"+red("--nodeps")+"\t do not manage any dependency") print_info(" \t\t\t"+red("--verbose")+"\t show more details about what's going on") print_info(" \t"+darkgreen(bold("database"))+brown("\t to handle installed packages database")) print_info(" \t\t"+darkgreen("generate")+red("\t\t generate installed packages database")) options = sys.argv[1:] # preliminary options parsing _options = [] for opt in options: if (opt == "--nocolor"): entropyTools.nocolor() elif (opt == "--debug"): entropyTools.enableDebug() else: _options.append(opt) options = _options # print version if (string.join(options).find("--version") != -1) or (string.join(options).find(" -V") != -1): entropyTools.print_generic(APPNAME+": "+APPVERSION) sys.exit(0) # print help if len(options) < 1 or string.join(options).find("--help") != -1 or string.join(options).find(" -h") != -1: print_help() if len(options) < 1: entropyTools.print_error("not enough parameters") sys.exit(1) # sync mirrors tool elif (options[0] == "repo"): rc = equoTools.repositories(options[1:]) sys.exit(rc) elif (options[0] == "package"): rc = equoTools.package(options[1:]) sys.exit(rc) elif (options[0] == "database"): rc = equoTools.database(options[1:]) sys.exit(rc)