From acdf616efa73b77936963eaa8b5c715db97646d2 Mon Sep 17 00:00:00 2001 From: fuzzyray Date: Tue, 8 Dec 2009 21:53:45 +0000 Subject: Merge rev 113 from djanderson's genscripts repo svn path=/trunk/gentoolkit/; revision=703 --- bin/eclean | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'bin/eclean') diff --git a/bin/eclean b/bin/eclean index 9953fa7..6fee381 100755 --- a/bin/eclean +++ b/bin/eclean @@ -9,7 +9,7 @@ from __future__ import with_statement # Meta: __author__ = "Thomas de Grenier de Latour (tgl)" __email__ = "degrenier@easyconnect.fr" -__version__ = open('/usr/share/gentoolkit/VERSION').read().strip() +__version__ = "svn" __productname__ = "eclean" __description__ = "A cleaning tool for Gentoo distfiles and binaries." @@ -206,14 +206,14 @@ def prettySize(size,justify=False): size = size / 1024. units.pop() sizestr = fpformat.fix(size,approx)+units[-1] - if justify: + if justify: sizestr = " " + blue("[ ") + " "*(7-len(sizestr)) \ + green(sizestr) + blue(" ]") return sizestr ############################################################################### -# yesNoAllPrompt: print a prompt until user answer in yes/no/all. Return a +# yesNoAllPrompt: print a prompt until user answer in yes/no/all. Return a # boolean for answer, and also may affect the 'accept_all' option. # Note: i gave up with getch-like functions, to much bugs in case of escape # sequences. Back to raw_input. @@ -259,8 +259,8 @@ def parseSize(size): ############################################################################### -# parseTime: convert a duration "Xu" ("X" is an int, and "u" a time unit in -# [Y,M,W,D,H]) into an integer which is a past EPOCH date. +# parseTime: convert a duration "Xu" ("X" is an int, and "u" a time unit in +# [Y,M,W,D,H]) into an integer which is a past EPOCH date. # Raises ParseArgsException('time') in case of failure. # (yep, big approximations inside... who cares?) def parseTime(timespec): @@ -287,7 +287,7 @@ def parseTime(timespec): # dict. def parseArgs(myoptions={}): - # local function for interpreting command line options + # local function for interpreting command line options # and setting myoptions accordingly def optionSwitch(myoption,opts,action=None): return_code = True @@ -323,7 +323,7 @@ def parseArgs(myoptions={}): # sanity check of --destructive only options: for myopt in ('fetch-restricted', 'package-names'): if (not myoptions['destructive']) and myoptions[myopt]: - if not myoptions['quiet']: + if not myoptions['quiet']: eerror("--%s only makes sense in --destructive mode." \ % myopt, myoptions['nocolor']) myoptions[myopt] = False @@ -429,14 +429,14 @@ def parseExcludeFile(filepath): filecontents = file.readlines() file.close() cat_re = re.compile('^(?P[a-zA-Z0-9]+-[a-zA-Z0-9]+)(/\*)?$') - cp_re = re.compile('^(?P[-a-zA-Z0-9_]+/[-a-zA-Z0-9_]+)$') + cp_re = re.compile('^(?P[-a-zA-Z0-9_]+/[-a-zA-Z0-9_]+)$') for line in filecontents: line = line.strip() if not len(line): continue if line[0] == '#': continue try: mycat = cat_re.match(line).group('cat') except: pass - else: + else: if not mycat in portage.settings.categories: raise ParseExcludeFileException("Invalid category: "+mycat) excl_dict['categories'][mycat] = None @@ -604,7 +604,7 @@ def findPackages( \ package_names=False): clean_dict = {} # create a full package dictionary - + if not (os.path.isdir(pkgdir)): eerror("%s does not appear to be a directory." % pkgdir, myoptions['nocolor']) eerror("Please set PKGDIR to a sane value.", myoptions['nocolor']) @@ -687,7 +687,7 @@ def doCleanup(clean_dict,action,myoptions): or yesNoAllPrompt(myoptions, \ "Do you want to delete this " \ + file_type+"?"): - # non-interactive mode or positive answer. + # non-interactive mode or positive answer. # For each file, try to delete the file and clean it out # of Packages metadata file if action == 'packages': @@ -713,7 +713,7 @@ def doCleanup(clean_dict,action,myoptions): clean_size += filesize if action == 'packages': metadata.packages[:] = [p for p in metadata.packages if 'CPV' in p and p['CPV'] != file] - + if action == 'packages': with open(os.path.join(pkgdir, 'Packages'), 'w') as metadata_file: metadata.write(metadata_file) @@ -740,7 +740,7 @@ def doAction(action,myoptions,exclude_dict={}): destructive=myoptions['destructive'], \ package_names=myoptions['package-names'], \ time_limit=myoptions['time-limit']) - else: + else: clean_dict = findDistfiles( \ myoptions, \ exclude_dict=exclude_dict, \ @@ -796,7 +796,7 @@ def main(): elif e.value == 'version': printVersion() sys.exit(0) - else: + else: printUsage(e.value) sys.exit(2) # parse the exclusion file @@ -811,7 +811,7 @@ def main(): eerror("Invalid exclusion file: %s" % myoptions['exclude-file'], \ myoptions['nocolor']) eerror("See format of this file in `man %s`" % __productname__, \ - myoptions['nocolor']) + myoptions['nocolor']) sys.exit(1) else: exclude_dict={} # security check for non-pretend mode -- cgit v1.2.3 From dc9f7175ec7ca6afc524e76786d2f46fb2c82229 Mon Sep 17 00:00:00 2001 From: fuzzyray Date: Thu, 7 Jan 2010 22:28:36 +0000 Subject: Update Copyright date headers svn path=/trunk/gentoolkit/; revision=731 --- bin/eclean | 4 ++-- bin/epkginfo | 2 +- bin/equery | 2 +- bin/euse | 2 +- bin/revdep-rebuild | 4 ++-- pym/gentoolkit/__init__.py | 2 +- pym/gentoolkit/atom.py | 2 +- pym/gentoolkit/cpv.py | 2 +- pym/gentoolkit/dbapi.py | 2 +- pym/gentoolkit/dependencies.py | 2 +- pym/gentoolkit/deprecated/helpers.py | 2 +- pym/gentoolkit/equery/__init__.py | 2 +- pym/gentoolkit/equery/belongs.py | 2 +- pym/gentoolkit/equery/changes.py | 2 +- pym/gentoolkit/equery/check.py | 2 +- pym/gentoolkit/equery/depends.py | 2 +- pym/gentoolkit/equery/depgraph.py | 2 +- pym/gentoolkit/equery/files.py | 2 +- pym/gentoolkit/equery/hasuse.py | 2 +- pym/gentoolkit/equery/list_.py | 2 +- pym/gentoolkit/equery/meta.py | 2 +- pym/gentoolkit/equery/size.py | 2 +- pym/gentoolkit/equery/uses.py | 2 +- pym/gentoolkit/equery/which.py | 2 +- pym/gentoolkit/errors.py | 2 +- pym/gentoolkit/helpers.py | 2 +- pym/gentoolkit/metadata.py | 2 +- pym/gentoolkit/package.py | 2 +- pym/gentoolkit/pprinter.py | 2 +- pym/gentoolkit/query.py | 2 +- pym/gentoolkit/test/__init__.py | 2 +- pym/gentoolkit/test/equery/__init__.py | 2 +- pym/gentoolkit/test/test_atom.py | 2 +- pym/gentoolkit/test/test_cpv.py | 2 +- pym/gentoolkit/versionmatch.py | 4 ++-- 35 files changed, 38 insertions(+), 38 deletions(-) (limited to 'bin/eclean') diff --git a/bin/eclean b/bin/eclean index 6fee381..158a953 100755 --- a/bin/eclean +++ b/bin/eclean @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright 2003-2005 Gentoo Foundation +# Copyright 2003-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ @@ -44,7 +44,7 @@ def printVersion(): % (__productname__, __version__, __description__) print print "Author: %s <%s>" % (__author__,__email__) - print "Copyright 2003-2009 Gentoo Foundation" + print "Copyright 2003-2010 Gentoo Foundation" print "Distributed under the terms of the GNU General Public License v2" diff --git a/bin/epkginfo b/bin/epkginfo index 650a870..c1f457c 100755 --- a/bin/epkginfo +++ b/bin/epkginfo @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2009 Gentoo Technologies, Inc. +# Copyright 2009-2010 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 or later # # $Header$ diff --git a/bin/equery b/bin/equery index e7bb6ce..d90495b 100755 --- a/bin/equery +++ b/bin/equery @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2002-2009 Gentoo Technologies, Inc. +# Copyright 2002-2010 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 or later # # $Header$ diff --git a/bin/euse b/bin/euse index 5950888..80e488b 100755 --- a/bin/euse +++ b/bin/euse @@ -116,7 +116,7 @@ cat << VER ${PROGRAM_NAME} (${VERSION}) Written by Marius Mauch -Copyright (C) 2004-2009 Gentoo Foundation, Inc. +Copyright (C) 2004-2010 Gentoo Foundation, Inc. This is free software; see the source for copying conditions. VER } diff --git a/bin/revdep-rebuild b/bin/revdep-rebuild index 9027a58..b6d80e6 100755 --- a/bin/revdep-rebuild +++ b/bin/revdep-rebuild @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2008 Gentoo Foundation +# Copyright 1999-2010 Gentoo Foundation # revdep-rebuild: Reverse dependency rebuilder. # Original Author: Stanislav Brabec @@ -167,7 +167,7 @@ print_usage() { cat << EOF ${APP_NAME}: (${VERSION}) -Copyright (C) 2003-2009 Gentoo Foundation, Inc. +Copyright (C) 2003-2010 Gentoo Foundation, Inc. This is free software; see the source for copying conditions. Usage: $APP_NAME [OPTIONS] [--] [EMERGE_OPTIONS] diff --git a/pym/gentoolkit/__init__.py b/pym/gentoolkit/__init__.py index 03382b7..37d609b 100644 --- a/pym/gentoolkit/__init__.py +++ b/pym/gentoolkit/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/python # # Copyright 2003-2004 Karl Trygve Kalleberg -# Copyright 2003-2009 Gentoo Foundation +# Copyright 2003-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # # $Header$ diff --git a/pym/gentoolkit/atom.py b/pym/gentoolkit/atom.py index 3523d60..8c29960 100644 --- a/pym/gentoolkit/atom.py +++ b/pym/gentoolkit/atom.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # diff --git a/pym/gentoolkit/cpv.py b/pym/gentoolkit/cpv.py index 9b3c2d7..31a9a9f 100644 --- a/pym/gentoolkit/cpv.py +++ b/pym/gentoolkit/cpv.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # diff --git a/pym/gentoolkit/dbapi.py b/pym/gentoolkit/dbapi.py index 2866214..fae1b6f 100644 --- a/pym/gentoolkit/dbapi.py +++ b/pym/gentoolkit/dbapi.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2009 Gentoo Foundation +# Copyright 2009-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # # $Header$ diff --git a/pym/gentoolkit/dependencies.py b/pym/gentoolkit/dependencies.py index 9ff7f90..001483e 100644 --- a/pym/gentoolkit/dependencies.py +++ b/pym/gentoolkit/dependencies.py @@ -1,4 +1,4 @@ -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # diff --git a/pym/gentoolkit/deprecated/helpers.py b/pym/gentoolkit/deprecated/helpers.py index d0fb993..68514d6 100644 --- a/pym/gentoolkit/deprecated/helpers.py +++ b/pym/gentoolkit/deprecated/helpers.py @@ -1,7 +1,7 @@ #!/usr/bin/python2 # # Copyright(c) 2004, Karl Trygve Kalleberg -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # diff --git a/pym/gentoolkit/equery/__init__.py b/pym/gentoolkit/equery/__init__.py index 84e8ced..5833f29 100644 --- a/pym/gentoolkit/equery/__init__.py +++ b/pym/gentoolkit/equery/__init__.py @@ -1,4 +1,4 @@ -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # diff --git a/pym/gentoolkit/equery/belongs.py b/pym/gentoolkit/equery/belongs.py index fcf58ab..3845b9d 100644 --- a/pym/gentoolkit/equery/belongs.py +++ b/pym/gentoolkit/equery/belongs.py @@ -1,4 +1,4 @@ -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # diff --git a/pym/gentoolkit/equery/changes.py b/pym/gentoolkit/equery/changes.py index 28611f9..8adf246 100644 --- a/pym/gentoolkit/equery/changes.py +++ b/pym/gentoolkit/equery/changes.py @@ -1,4 +1,4 @@ -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 or higher # diff --git a/pym/gentoolkit/equery/check.py b/pym/gentoolkit/equery/check.py index 6ce288c..5969804 100644 --- a/pym/gentoolkit/equery/check.py +++ b/pym/gentoolkit/equery/check.py @@ -1,4 +1,4 @@ -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # diff --git a/pym/gentoolkit/equery/depends.py b/pym/gentoolkit/equery/depends.py index 759ecba..a1061fc 100644 --- a/pym/gentoolkit/equery/depends.py +++ b/pym/gentoolkit/equery/depends.py @@ -1,4 +1,4 @@ -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # diff --git a/pym/gentoolkit/equery/depgraph.py b/pym/gentoolkit/equery/depgraph.py index 18d19ba..9c7e346 100644 --- a/pym/gentoolkit/equery/depgraph.py +++ b/pym/gentoolkit/equery/depgraph.py @@ -1,4 +1,4 @@ -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # diff --git a/pym/gentoolkit/equery/files.py b/pym/gentoolkit/equery/files.py index 400e4b1..f0c40ee 100644 --- a/pym/gentoolkit/equery/files.py +++ b/pym/gentoolkit/equery/files.py @@ -1,4 +1,4 @@ -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # diff --git a/pym/gentoolkit/equery/hasuse.py b/pym/gentoolkit/equery/hasuse.py index bc4bb63..8d51013 100644 --- a/pym/gentoolkit/equery/hasuse.py +++ b/pym/gentoolkit/equery/hasuse.py @@ -1,4 +1,4 @@ -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 or higher # diff --git a/pym/gentoolkit/equery/list_.py b/pym/gentoolkit/equery/list_.py index c727590..3de8355 100644 --- a/pym/gentoolkit/equery/list_.py +++ b/pym/gentoolkit/equery/list_.py @@ -1,4 +1,4 @@ -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 or higher # diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py index 1fc8964..c0a6c4c 100644 --- a/pym/gentoolkit/equery/meta.py +++ b/pym/gentoolkit/equery/meta.py @@ -1,4 +1,4 @@ -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 or higher # diff --git a/pym/gentoolkit/equery/size.py b/pym/gentoolkit/equery/size.py index f7b8888..4d2a686 100644 --- a/pym/gentoolkit/equery/size.py +++ b/pym/gentoolkit/equery/size.py @@ -1,4 +1,4 @@ -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # diff --git a/pym/gentoolkit/equery/uses.py b/pym/gentoolkit/equery/uses.py index d38dfe5..8358d49 100644 --- a/pym/gentoolkit/equery/uses.py +++ b/pym/gentoolkit/equery/uses.py @@ -1,4 +1,4 @@ -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # diff --git a/pym/gentoolkit/equery/which.py b/pym/gentoolkit/equery/which.py index 38a8c6b..be4f5e8 100644 --- a/pym/gentoolkit/equery/which.py +++ b/pym/gentoolkit/equery/which.py @@ -1,4 +1,4 @@ -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # diff --git a/pym/gentoolkit/errors.py b/pym/gentoolkit/errors.py index 988d91c..9bcc5f9 100644 --- a/pym/gentoolkit/errors.py +++ b/pym/gentoolkit/errors.py @@ -1,4 +1,4 @@ -# Copyright(c) 2004-2009, Gentoo Foundation +# Copyright(c) 2004-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 or later diff --git a/pym/gentoolkit/helpers.py b/pym/gentoolkit/helpers.py index 6956f97..ee3e5bf 100644 --- a/pym/gentoolkit/helpers.py +++ b/pym/gentoolkit/helpers.py @@ -1,4 +1,4 @@ -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 or higher # diff --git a/pym/gentoolkit/metadata.py b/pym/gentoolkit/metadata.py index 792e65f..02fe03f 100644 --- a/pym/gentoolkit/metadata.py +++ b/pym/gentoolkit/metadata.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # diff --git a/pym/gentoolkit/package.py b/pym/gentoolkit/package.py index c020f63..7054470 100644 --- a/pym/gentoolkit/package.py +++ b/pym/gentoolkit/package.py @@ -1,7 +1,7 @@ #!/usr/bin/python # # Copyright(c) 2004, Karl Trygve Kalleberg -# Copyright(c) 2004-2009, Gentoo Foundation +# Copyright(c) 2004-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # diff --git a/pym/gentoolkit/pprinter.py b/pym/gentoolkit/pprinter.py index bd5e6cb..c070a0f 100644 --- a/pym/gentoolkit/pprinter.py +++ b/pym/gentoolkit/pprinter.py @@ -1,7 +1,7 @@ #!/usr/bin/python # # Copyright 2004 Karl Trygve Kalleberg -# Copyright 2004-2009 Gentoo Foundation +# Copyright 2004-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # # $Header$ diff --git a/pym/gentoolkit/query.py b/pym/gentoolkit/query.py index 24f8c18..4802bc1 100644 --- a/pym/gentoolkit/query.py +++ b/pym/gentoolkit/query.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright(c) 2004-2009, Gentoo Foundation +# Copyright 2004-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # diff --git a/pym/gentoolkit/test/__init__.py b/pym/gentoolkit/test/__init__.py index 94423e9..901e478 100644 --- a/pym/gentoolkit/test/__init__.py +++ b/pym/gentoolkit/test/__init__.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright 2009 Gentoo Foundation +# Copyright 2009-2010 Gentoo Foundation # # Distributed under the terms of the GNU General Public License v2 # diff --git a/pym/gentoolkit/test/equery/__init__.py b/pym/gentoolkit/test/equery/__init__.py index 94423e9..901e478 100644 --- a/pym/gentoolkit/test/equery/__init__.py +++ b/pym/gentoolkit/test/equery/__init__.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright 2009 Gentoo Foundation +# Copyright 2009-2010 Gentoo Foundation # # Distributed under the terms of the GNU General Public License v2 # diff --git a/pym/gentoolkit/test/test_atom.py b/pym/gentoolkit/test/test_atom.py index 4a1568b..0c5a786 100644 --- a/pym/gentoolkit/test/test_atom.py +++ b/pym/gentoolkit/test/test_atom.py @@ -1,4 +1,4 @@ -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation, Inc. # Copyright: 2006-2008 Brian Harring # # License: GPL2/BSD diff --git a/pym/gentoolkit/test/test_cpv.py b/pym/gentoolkit/test/test_cpv.py index 9b36cc3..833fd49 100644 --- a/pym/gentoolkit/test/test_cpv.py +++ b/pym/gentoolkit/test/test_cpv.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright(c) 2009, Gentoo Foundation +# Copyright(c) 2009-2010, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # diff --git a/pym/gentoolkit/versionmatch.py b/pym/gentoolkit/versionmatch.py index a11cc9a..e3afe69 100644 --- a/pym/gentoolkit/versionmatch.py +++ b/pym/gentoolkit/versionmatch.py @@ -1,9 +1,9 @@ #! /usr/bin/python # -# Copyright(c) 2009 Gentoo Foundation +# Copyright(c) 2009-2010 Gentoo Foundation # Licensed under the GNU General Public License, v2 # -# Copyright: 2005-2007 Brian Harring +# Copyright(c): 2005-2007 Brian Harring # License: GPL2/BSD # # $Header$ -- cgit v1.2.3 From 2f90a4b9ceff920f793541376da21d313af083d9 Mon Sep 17 00:00:00 2001 From: fuzzyray Date: Tue, 9 Mar 2010 16:42:04 +0000 Subject: sync with genscripts rev 343. This adds the initial py3k support and the analyse utility to gentoolkit svn path=/trunk/gentoolkit/; revision=751 --- ChangeLog | 7 +- README.dev | 2 +- TODO | 14 +- bin/analyse | 48 ++++ bin/eclean | 211 +++++++------- bin/epkginfo | 10 +- bin/equery | 14 +- bin/euse | 2 +- bin/glsa-check | 30 +- bin/revdep-rebuild | 2 +- man/analyse.1 | 202 ++++++++++++++ man/equery.1 | 2 +- pym/analyse | 46 +++ pym/gentoolkit/__init__.py | 4 +- pym/gentoolkit/analyse/__init__.py | 129 +++++++++ pym/gentoolkit/analyse/analyse.py | 355 ++++++++++++++++++++++++ pym/gentoolkit/analyse/base.py | 136 +++++++++ pym/gentoolkit/analyse/lib.py | 477 ++++++++++++++++++++++++++++++++ pym/gentoolkit/analyse/output.py | 213 ++++++++++++++ pym/gentoolkit/analyse/rebuild.py | 215 ++++++++++++++ pym/gentoolkit/atom.py | 13 +- pym/gentoolkit/base.py | 151 ++++++++++ pym/gentoolkit/cpv.py | 39 ++- pym/gentoolkit/dbapi.py | 2 +- pym/gentoolkit/dependencies.py | 15 +- pym/gentoolkit/deprecated/helpers.py | 22 +- pym/gentoolkit/equery/__init__.py | 39 +-- pym/gentoolkit/equery/belongs.py | 34 +-- pym/gentoolkit/equery/changes.py | 85 +++--- pym/gentoolkit/equery/check.py | 67 +++-- pym/gentoolkit/equery/depends.py | 38 +-- pym/gentoolkit/equery/depgraph.py | 115 +++++--- pym/gentoolkit/equery/files.py | 109 ++++---- pym/gentoolkit/equery/hasuse.py | 102 ++++--- pym/gentoolkit/equery/list_.py | 131 +++++---- pym/gentoolkit/equery/meta.py | 88 +++--- pym/gentoolkit/equery/size.py | 77 +++--- pym/gentoolkit/equery/uses.py | 88 +++--- pym/gentoolkit/equery/which.py | 43 +-- pym/gentoolkit/errors.py | 27 +- pym/gentoolkit/formatters.py | 101 +++++++ pym/gentoolkit/glsa/__init__.py | 35 ++- pym/gentoolkit/helpers.py | 341 ++++------------------- pym/gentoolkit/keyword.py | 105 +++++++ pym/gentoolkit/metadata.py | 7 +- pym/gentoolkit/package.py | 194 ++++++++++--- pym/gentoolkit/pprinter.py | 20 +- pym/gentoolkit/query.py | 334 +++++++++++++++++++++- pym/gentoolkit/sets.py | 57 ++++ pym/gentoolkit/test/__init__.py | 21 +- pym/gentoolkit/test/equery/__init__.py | 2 +- pym/gentoolkit/test/equery/test_init.py | 5 +- pym/gentoolkit/test/test_atom.py | 8 +- pym/gentoolkit/test/test_cpv.py | 30 +- pym/gentoolkit/test/test_helpers.py | 56 ++-- pym/gentoolkit/test/test_keyword.py | 43 +++ pym/gentoolkit/test/test_syntax.py | 9 +- pym/gentoolkit/versionmatch.py | 6 +- setup.py | 15 +- 59 files changed, 3732 insertions(+), 1061 deletions(-) create mode 100755 bin/analyse create mode 100644 man/analyse.1 create mode 100755 pym/analyse create mode 100644 pym/gentoolkit/analyse/__init__.py create mode 100644 pym/gentoolkit/analyse/analyse.py create mode 100644 pym/gentoolkit/analyse/base.py create mode 100644 pym/gentoolkit/analyse/lib.py create mode 100644 pym/gentoolkit/analyse/output.py create mode 100644 pym/gentoolkit/analyse/rebuild.py create mode 100644 pym/gentoolkit/base.py create mode 100644 pym/gentoolkit/formatters.py create mode 100644 pym/gentoolkit/keyword.py create mode 100644 pym/gentoolkit/sets.py create mode 100644 pym/gentoolkit/test/test_keyword.py (limited to 'bin/eclean') diff --git a/ChangeLog b/ChangeLog index a1f4395..63d781c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ +2010-03-09: Paul Varner + * gentoolkit: Add inital py3k support. + * analyse: Add new analyse utility from dol-sen. This will probably + change to a different name for final gentoolkit-0.3.0 release. + 2010-02-05: Paul Varner - *revdep-rebuild: Update revdep-rebuild to use extended regular + * revdep-rebuild: Update revdep-rebuild to use extended regular expressions instead of basic regular expressions. (Bug 143498) 2010-02-04: Paul Varner diff --git a/README.dev b/README.dev index 37864fb..99a7ed4 100644 --- a/README.dev +++ b/README.dev @@ -25,7 +25,7 @@ svn copy svn+ssh://@svn.gentoo.org/var/svnroot/gentoolkit/trunk/gentoolkit svn update to pull the tag from subversion cd to the local tags/gentoolkit-0.3.0 directory -- Create a source distribution (you need to add VERSION here, too): +- Create a source distribution (you need to add VERSION here): VERSION="0.3.0" ./setup.py sdist Transfer dist/gentoolkit-0.3.0.tar.gz to dev.gentoo.org:/space/distfiles-local diff --git a/TODO b/TODO index d3e2cb2..f4d4124 100644 --- a/TODO +++ b/TODO @@ -20,10 +20,22 @@ - use ~/.gentoo/gentoolkit/ebump.conf - use /etc/gentoolkit/ebump.conf -equery: +equery (modern): Add more --debug stuff Write tests for Dependencies._parser Profile Dependencies._parser + Tighten up CPV.split_cpv, it's slow and bad + Extend PackageFormatter usage to everything that outputs packages to + allow for purvasive use of -F, --format goodness + Add package::repo search syntax to do_lookup + _do_repository_lookup? + Move do_lookout and all it's silly friends into the new query module + and Query class. Essentially, Query, when applied to a pkgspec input + should contain most of the common 'helper' methods. So we should be + be able to do: + Query('portage').find_best(), + Query('portage').find_package(), + Query('portag*').is_regex() or .uses_globbing(), etc. Refactor each module to be useful for import. Done modules: +depends +belongs diff --git a/bin/analyse b/bin/analyse new file mode 100755 index 0000000..a90410b --- /dev/null +++ b/bin/analyse @@ -0,0 +1,48 @@ +#!/usr/bin/python +# +# Copyright 2010 Brian Dolbec +# Copyright 2002-2010 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 or later +# +# $Header$ + +"""'analyse' is a flexible utility for Gentoo linux which can display various +information about installed packages, such as the USE flags used and the +packages that use them. It can also be used to help rebuild /etc/portage/package.* +files in the event of corruption, and possibly more. +""" + +from __future__ import print_function + +import sys +# This block ensures that ^C interrupts are handled quietly. +try: + import signal + + def exithandler(signum,frame): + signal.signal(signal.SIGINT, signal.SIG_IGN) + signal.signal(signal.SIGTERM, signal.SIG_IGN) + print() + sys.exit(1) + + signal.signal(signal.SIGINT, exithandler) + signal.signal(signal.SIGTERM, exithandler) + signal.signal(signal.SIGPIPE, signal.SIG_DFL) + +except KeyboardInterrupt: + print() + sys.exit(1) + +from gentoolkit import analyse, errors + +try: + analyse.main() +except errors.GentoolkitException as err: + if '--debug' in sys.argv: + raise + else: + from gentoolkit import pprinter as pp + sys.stderr.write(pp.error(str(err))) + print() + print("Add '--debug' to global options for traceback.") + sys.exit(1) diff --git a/bin/eclean b/bin/eclean index 158a953..2d7f09c 100755 --- a/bin/eclean +++ b/bin/eclean @@ -1,9 +1,10 @@ #!/usr/bin/python -# Copyright 2003-2010 Gentoo Foundation +# Copyright 2003-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ -from __future__ import with_statement +from __future__ import print_function + ############################################################################### # Meta: @@ -18,15 +19,17 @@ __description__ = "A cleaning tool for Gentoo distfiles and binaries." # Python imports: import sys -import os, stat +import stat import re import time import getopt -import fpformat import signal import portage from portage.output import * +from portage import os + +from gentoolkit.helpers import walk listdir = portage.listdir @@ -40,12 +43,12 @@ pkgdir = port_settings["PKGDIR"] ############################################################################### # printVersion: def printVersion(): - print "%s (%s) - %s" \ - % (__productname__, __version__, __description__) - print - print "Author: %s <%s>" % (__author__,__email__) - print "Copyright 2003-2010 Gentoo Foundation" - print "Distributed under the terms of the GNU General Public License v2" + print("%s (%s) - %s" \ + % (__productname__, __version__, __description__)) + print() + print("Author: %s <%s>" % (__author__,__email__)) + print("Copyright 2003-2009 Gentoo Foundation") + print("Distributed under the terms of the GNU General Public License v2") ############################################################################### @@ -62,112 +65,112 @@ def printUsage(error=None,help=None): if not error and not help: help = 'all' if error == 'time': eerror("Wrong time specification") - print >>out, "Time specification should be an integer followed by a"+ \ - " single letter unit." - print >>out, "Available units are: y (years), m (months), w (weeks), "+ \ - "d (days) and h (hours)." - print >>out, "For instance: \"1y\" is \"one year\", \"2w\" is \"two"+ \ - " weeks\", etc. " + print("Time specification should be an integer followed by a"+ \ + " single letter unit.", file=out) + print("Available units are: y (years), m (months), w (weeks), "+ \ + "d (days) and h (hours).", file=out) + print("For instance: \"1y\" is \"one year\", \"2w\" is \"two"+ \ + " weeks\", etc. ", file=out) return if error == 'size': eerror("Wrong size specification") - print >>out, "Size specification should be an integer followed by a"+ \ - " single letter unit." - print >>out, "Available units are: G, M, K and B." - print >>out, "For instance: \"10M\" is \"ten megabytes\", \"200K\" "+ \ - "is \"two hundreds kilobytes\", etc." + print("Size specification should be an integer followed by a"+ \ + " single letter unit.", file=out) + print("Available units are: G, M, K and B.", file=out) + print("For instance: \"10M\" is \"ten megabytes\", \"200K\" "+ \ + "is \"two hundreds kilobytes\", etc.", file=out) return if error in ('global-options', 'packages-options', 'distfiles-options', \ 'merged-packages-options', 'merged-distfiles-options',): eerror("Wrong option on command line.") - print >>out + print(file=out) elif error == 'actions': eerror("Wrong or missing action name on command line.") - print >>out - print >>out, white("Usage:") + print(file=out) + print(white("Usage:"), file=out) if error in ('actions','global-options', 'packages-options', \ 'distfiles-options') or help == 'all': - print >>out, " "+turquoise(__productname__), \ + print(" "+turquoise(__productname__), \ yellow("[global-option] ..."), \ green(""), \ - yellow("[action-option] ...") + yellow("[action-option] ..."), file=out) if error == 'merged-distfiles-options' or help in ('all','distfiles'): - print >>out, " "+turquoise(__productname__+'-dist'), \ - yellow("[global-option, distfiles-option] ...") + print(" "+turquoise(__productname__+'-dist'), \ + yellow("[global-option, distfiles-option] ..."), file=out) if error == 'merged-packages-options' or help in ('all','packages'): - print >>out, " "+turquoise(__productname__+'-pkg'), \ - yellow("[global-option, packages-option] ...") + print(" "+turquoise(__productname__+'-pkg'), \ + yellow("[global-option, packages-option] ..."), file=out) if error in ('global-options', 'actions'): - print >>out, " "+turquoise(__productname__), \ - yellow("[--help, --version]") + print(" "+turquoise(__productname__), \ + yellow("[--help, --version]"), file=out) if help == 'all': - print >>out, " "+turquoise(__productname__+"(-dist,-pkg)"), \ - yellow("[--help, --version]") + print(" "+turquoise(__productname__+"(-dist,-pkg)"), \ + yellow("[--help, --version]"), file=out) if error == 'merged-packages-options' or help == 'packages': - print >>out, " "+turquoise(__productname__+'-pkg'), \ - yellow("[--help, --version]") + print(" "+turquoise(__productname__+'-pkg'), \ + yellow("[--help, --version]"), file=out) if error == 'merged-distfiles-options' or help == 'distfiles': - print >>out, " "+turquoise(__productname__+'-dist'), \ - yellow("[--help, --version]") - print >>out + print(" "+turquoise(__productname__+'-dist'), \ + yellow("[--help, --version]"), file=out) + print(file=out) if error in ('global-options', 'merged-packages-options', \ 'merged-distfiles-options') or help: - print >>out, "Available global", yellow("options")+":" - print >>out, yellow(" -C, --nocolor")+ \ - " - turn off colors on output" - print >>out, yellow(" -d, --destructive")+ \ - " - only keep the minimum for a reinstallation" - print >>out, yellow(" -e, --exclude-file=")+ \ - " - path to the exclusion file" - print >>out, yellow(" -i, --interactive")+ \ - " - ask confirmation before deletions" - print >>out, yellow(" -n, --package-names")+ \ - " - protect all versions (when --destructive)" - print >>out, yellow(" -p, --pretend")+ \ - " - only display what would be cleaned" - print >>out, yellow(" -q, --quiet")+ \ - " - be as quiet as possible" - print >>out, yellow(" -t, --time-limit=