def _construct_env(self, env, extra): if env: env = dict((encode_to_system(k), encode_to_system(v)) for k, v in env.items()) for key in extra: if not key.startswith("env:"): raise RuntimeError("Keyword argument '%s' is not supported by " "this keyword." % key) if env is None: env = os.environ.copy() env[encode_to_system(key[4:])] = encode_to_system(extra[key]) return env
def _construct_env(self, env, rest): for key in rest: if not key.startswith('env:'): raise RuntimeError("'%s' is not supported by this keyword." % key) if env is None: env = get_env_vars(upper=False) env[key[4:]] = rest[key] if env: env = dict((encode_to_system(key), encode_to_system(env[key])) for key in env) return env
def _construct_env(self, env, extra): if env: env = dict((encode_to_system(k), encode_to_system(v)) for k, v in env.items()) for key in extra: if not key.startswith('env:'): raise RuntimeError("'%s' is not supported by this keyword." % key) if env is None: env = os.environ.copy() env[encode_to_system(key[4:])] = encode_to_system(extra[key]) return env
def _cmd(self, command, args, use_shell): command = [encode_to_system(item) for item in [command] + list(args)] if not use_shell: return command if args: return subprocess.list2cmdline(command) return command[0]
def _cmd(self, args, command, use_shell): command = [encode_to_system(item) for item in [command] + list(args)] if not use_shell: return command if args: return subprocess.list2cmdline(command) return command[0]
def __str__(self): return encode_to_system("""\ cwd = %s stdout_stream = %s stderr_stream = %s shell = %r alias = %s env = %r""" % (self.cwd, self.stdout_stream, self.stderr_stream, self.shell, self.alias, self.env))