~juju-qa/juju-ci-tools/trunk

« back to all changes in this revision

Viewing changes to jujupy.py

  • Committer: Seman Said
  • Date: 2016-12-08 02:39:36 UTC
  • mto: (1795.2.1 mega-watcher-py3)
  • mto: This revision was merged to the branch mainline in revision 1797.
  • Revision ID: seman.said@canonical.com-20161208023936-94eqb3eo7lgio1sy
Updated after a code review.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import json
18
18
import logging
19
19
import os
20
 
try:
21
 
    from past.builtins import basestring
22
 
except ImportError:
23
 
    pass
24
20
import re
25
21
import shutil
26
22
import subprocess
1109
1105
            prefix = get_timeout_prefix(timeout, self._timeout_path)
1110
1106
        logging = '--debug' if self.debug else '--show-log'
1111
1107
 
 
1108
        # Python 2 and 3 compatibility
 
1109
        try:
 
1110
            argtype = basestring
 
1111
        except NameError:
 
1112
            argtype = str
1112
1113
        # If args is a string, make it a tuple. This makes writing commands
1113
1114
        # with one argument a bit nicer.
1114
 
        if isinstance(args, basestring):
 
1115
        if isinstance(args, argtype):
1115
1116
            args = (args,)
1116
1117
        # we split the command here so that the caller can control where the -m
1117
1118
        # model flag goes.  Everything in the command string is put before the