numpy.distutils.exec_command
index
/usr/lib/python2.6/dist-packages/numpy/distutils/exec_command.py

exec_command
 
Implements exec_command function that is (almost) equivalent to
commands.getstatusoutput function but on NT, DOS systems the
returned status is actually correct (though, the returned status
values may be different by a factor). In addition, exec_command
takes keyword arguments for (re-)defining environment variables.
 
Provides functions:
  exec_command  --- execute command in a specified directory and
                    in the modified environment.
  find_executable --- locate a command using info from environment
                    variable PATH. Equivalent to posix `which`
                    command.
 
Author: Pearu Peterson <pearu@cens.ioc.ee>
Created: 11 January 2003
 
Requires: Python 2.x
 
Succesfully tested on:
  os.name | sys.platform | comments
  --------+--------------+----------
  posix   | linux2       | Debian (sid) Linux, Python 2.1.3+, 2.2.3+, 2.3.3
                           PyCrust 0.9.3, Idle 1.0.2
  posix   | linux2       | Red Hat 9 Linux, Python 2.1.3, 2.2.2, 2.3.2
  posix   | sunos5       | SunOS 5.9, Python 2.2, 2.3.2
  posix   | darwin       | Darwin 7.2.0, Python 2.3
  nt      | win32        | Windows Me
                           Python 2.3(EE), Idle 1.0, PyCrust 0.7.2
                           Python 2.1.1 Idle 0.8
  nt      | win32        | Windows 98, Python 2.1.1. Idle 0.8
  nt      | win32        | Cygwin 98-4.10, Python 2.1.1(MSC) - echo tests
                           fail i.e. redefining environment variables may
                           not work. FIXED: don't use cygwin echo!
                           Comment: also `cmd /c echo` will not work
                           but redefining environment variables do work.
  posix   | cygwin       | Cygwin 98-4.10, Python 2.3.3(cygming special)
  nt      | win32        | Windows XP, Python 2.3.3
 
Known bugs:
- Tests, that send messages to stderr, fail when executed from MSYS prompt
  because the messages are lost at some point.

 
Modules
       
numpy.distutils.log
os
shlex
sys

 
Functions
       
_exec_command(command, use_shell=None, use_tee=None, **env)
_exec_command_posix(command, use_shell=None, use_tee=None, **env)
_exec_command_python(command, exec_command_dir='', **env)
_preserve_environment(names)
_update_environment(**env)
exec_command(command, execute_in='', use_shell=None, use_tee=None, _with_python=1, **env)
Return (status,output) of executed command.
 
command is a concatenated string of executable and arguments.
The output contains both stdout and stderr messages.
The following special keyword arguments can be used:
  use_shell - execute `sh -c command`
  use_tee   - pipe the output of command through tee
  execute_in - before run command `cd execute_in` and after `cd -`.
 
On NT, DOS systems the returned status is correct for external commands.
Wild cards will not work for non-posix systems or when use_shell=0.
find_executable(exe, path=None, _cache={})
Return full path of a executable or None.
 
Symbolic links are not followed.
get_pythonexe()
quote_arg(arg)
splitcmdline(line)
temp_file_name()
test = test_posix(**kws)
test_cl(**kws)
test_execute_in(**kws)
test_nt(**kws)
test_posix(**kws)
test_svn(**kws)

 
Data
        __all__ = ['exec_command', 'find_executable']
__file__ = '/usr/lib/python2.6/dist-packages/numpy/distutils/exec_command.pyc'
__name__ = 'numpy.distutils.exec_command'
__package__ = 'numpy.distutils'