~ubuntu-branches/ubuntu/saucy/devscripts/saucy

« back to all changes in this revision

Viewing changes to scripts/devscripts/logger.py

  • Committer: Package Import Robot
  • Author(s): Benjamin Drung, David Prévot, James McCoy, Benjamin Drung, Stefano Rivera, Salvatore Bonaccorso, Raphael Geissert, Kees Cook, Thijs Kinkhorst, Scott Moser, Yaroslav Halchenko, Ivan Borzenkov
  • Date: 2012-05-31 17:50:56 UTC
  • mfrom: (10.9.13 sid)
  • Revision ID: package-import@ubuntu.com-20120531175056-ybzrfssrbk61ba7y
Tags: 2.11.8
[ David Prévot ]
* French translation update.

[ James McCoy ]
* dd-list:
  + Recognize -h argument, as documented.
  + Don't error when given multiple binary packages from the same source.
    (Closes: #672309)
* Also note DEBCHANGE_MAINTTRAILER change in NEWS entry for 2.11.7.
  (Closes: #672973)
* dget:
  + Fix handling of sources.list entries with a port. (Closes: #672460) Still
    can't handle entries at the same domain but different ports until
    #154868 is fixed.
* debcheckout:
  + Document the DEBCHECKOUT_SOURCE configuration variable.
  + Determine the source package name when downloading the source tarball.
    This ensures the downloaded files aren't incorrectly removed after being
    downloaded.
  + Adapt find_repo() to determine the tarball name for native packages.

[ Benjamin Drung ]
* debchange:
  + Add --vendor= and DEBCHANGE_VENDOR to override the distributor ID
    returned by dpkg-vendor.
  + Always perform Vendor check.
  + Fall back to Debian vendor when a Debian-specific command-line option
    has been supplied (--nmu, --qa, --bin-nmu, --bpo).
  + Adjust --security template for Ubuntu.
  + Add -R/--rebuild flag for Ubuntu's no-change rebuilds.
  + Append ubuntu1 to version when incrementing on Ubuntu, unless a
    -U/--upstream option is given.
  + On Ubuntu, don't copy the previous distribution name for a new changelog
    entry. Use the Ubuntu devel release.
  + Don't use NMU versioning for NMUs / Security uploads on Ubuntu.
  + dch --increment changes XbuildY to Xubuntu1 on Ubuntu (LP: #690230).
  + Try to guess the vendor based on the given distribution name (LP: #723715)
  + Prefer UBUMAIL over DEBEMAIL on Ubuntu (LP: #929846).
* Add first tests for licensecheck.
* Add online test for uscan.

[ Stefano Rivera ]
* devscripts.Logger Don't substitute arguments into logged strings unless
  they were provided. (LP: #968129)
* debchange: Use distro-info to determine Ubuntu release names (LP: #997932).
* Incorporate Ubuntu's delta:
  Move debian-keyring, equivs, libcrypt-ssleay-perl, and libsoap-lite-perl
  to Suggests when building on Ubuntu.

[ Salvatore Bonaccorso ]
* bts: When searching for usertags use tag= in the url (followed by
  the options containing users=). (Closes: #675071).

[ Raphael Geissert ]
* dget: ignore duplicate repository URLs. (Closes: #675258)

[ Kees Cook ]
* licensecheck: Catch LGPL more robustly. (Closes: #623283)

[ Thijs Kinkhorst ]
* debdiff: Do not generate warnings when debdiff'ing dpkg source format
  3.0 (git). (Closes: #668372)
* debuild: Do not warn for missing upstream tarball if package is source
  format 3.0 (git). (Closes: #668372)

[ Scott Moser ]
* uscan: Support watch files that reference S3 bucket listings.
  (Closes: #630756, LP: #798293)

[ Yaroslav Halchenko ]
* licensecheck: Check licenses in .m (Octave/Matlab), .tex (LaTeX),
  and .pyx (Python's pyrex) files (Closes: #604529)

[ Ivan Borzenkov ]
* licensecheck: Add detection code for Beerware license. (Closes: #597463)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import os
21
21
import sys
22
22
 
 
23
 
23
24
def escape_arg(arg):
24
 
    "Shell-escpae arg, if necessary"
 
25
    """Shell-escpae arg, if necessary.
 
26
    Fairly simplistic, doesn't escape anything except whitespace.
 
27
    """
25
28
    if ' ' not in arg:
26
29
        return arg
27
30
    return '"%s"' % arg.replace('\\', r'\\').replace('"', r'\"')
28
31
 
 
32
 
29
33
class Logger(object):
30
34
    script_name = os.path.basename(sys.argv[0])
31
35
    verbose = False
34
38
    stderr = sys.stderr
35
39
 
36
40
    @classmethod
 
41
    def _print(cls, format_, message, args=None, stderr=False):
 
42
        if args:
 
43
            message = message % args
 
44
        stream = cls.stderr if stderr else cls.stdout
 
45
        print >> stream, format_ % (cls.script_name, message)
 
46
 
 
47
    @classmethod
37
48
    def command(cls, cmd):
38
49
        if cls.verbose:
39
 
            print >> cls.stdout, "%s: I: %s" % (cls.script_name,
40
 
                                                " ".join(escape_arg(arg)
41
 
                                                         for arg in cmd))
 
50
            cls._print("%s: I: %s", " ".join(escape_arg(arg) for arg in cmd))
42
51
 
43
52
    @classmethod
44
53
    def debug(cls, message, *args):
45
54
        if cls.verbose:
46
 
            print >> cls.stderr, "%s: D: %s" % (cls.script_name, message % args)
 
55
            cls._print("%s: D: %s", message, args, stderr=True)
47
56
 
48
57
    @classmethod
49
58
    def error(cls, message, *args):
50
 
        print >> cls.stderr, "%s: Error: %s" % (cls.script_name, message % args)
 
59
        cls._print("%s: Error: %s", message, args, stderr=True)
51
60
 
52
61
    @classmethod
53
62
    def warn(cls, message, *args):
54
 
        print >> cls.stderr, "%s: Warning: %s" % (cls.script_name,
55
 
                                                  message % args)
 
63
        cls._print("%s: Warning: %s", message, args, stderr=True)
56
64
 
57
65
    @classmethod
58
66
    def info(cls, message, *args):
59
67
        if cls.verbose:
60
 
            print >> cls.stdout, "%s: I: %s" % (cls.script_name, message % args)
 
68
            cls._print("%s: I: %s", message, args)
61
69
 
62
70
    @classmethod
63
71
    def normal(cls, message, *args):
64
 
        print >> cls.stdout, "%s: %s" % (cls.script_name, message % args)
 
72
        cls._print("%s: %s", message, args)
65
73
 
66
74
    @classmethod
67
75
    def set_verbosity(cls, verbose):