# coding=utf-8

"""
Command line interface for brandon
"""

import argparse

from devpi_builder import requirements, wheeler, devpi


def main(args=None):
    parser = argparse.ArgumentParser(description='Create wheels for all given project versions and upload them to the given index.')
    parser.add_argument('requirements', help='requirements.txt style file specifying which project versions to package.')
    parser.add_argument('index', help='The index to upload the packaged software to.')
    parser.add_argument('user', help='The user to log in as.')
    parser.add_argument('password', help='Password of the user.')
    parser.add_argument('--blacklist', help='Packages matched by this requirements.txt style file will never be build.')

    args = parser.parse_args(args=args)

    with wheeler.Builder() as builder, devpi.Client(args.index, args.user, args.password) as devpi_client:
        for package, version in requirements.read(args.requirements):

            if devpi_client.package_version_exists(package, version):
                continue

            if args.blacklist and requirements.matched_by_file(package, version, args.blacklist):
                print('Skipping {} {} as it is matched by the blacklist.'.format(package, version))
            else:
                print('Building {} {}.'.format(package, version))
                try:
                    wheel_file = builder(package, version)
                    devpi_client.upload(wheel_file)
                except wheeler.BuildError as e:
                    print(e)

@@ -68,16 +68,31 @@
 argparse
+%0Aimport logging
 %0A%0Afrom d
@@ -141,16 +141,76 @@
  devpi%0A%0A
+logging.basicConfig()%0Alogger = logging.getLogger(__name__)%0A%0A
 %0Adef mai
@@ -1245,21 +1245,27 @@
         
-print
+logger.info
 ('Skippi
@@ -1267,21 +1267,21 @@
 kipping 
-%7B%7D %7B%7D
+%25s %25s
  as it i
@@ -1308,24 +1308,18 @@
 cklist.'
-.format(
+, 
 package,
@@ -1319,33 +1319,32 @@
 ackage, version)
-)
 %0A            els
@@ -1366,39 +1366,38 @@
     
-print('Building %7B%7D %7B%7D.'.format(
+logger.info('Building %25s %25s', 
 pack
@@ -1409,17 +1409,16 @@
 version)
-)
 %0A       
@@ -1614,13 +1614,24 @@
     
-print
+logger.exception
 (e)%0A

Use a logger instead of printing to stdout