diff options
author | mattip <matti.picus@gmail.com> | 2019-01-30 13:01:21 +0200 |
---|---|---|
committer | mattip <matti.picus@gmail.com> | 2019-03-10 12:19:16 +0200 |
commit | be0803611defdad708eb3e00d7f81846f5c1f436 (patch) | |
tree | 2c3feb4f8ba56c516c9ea571de7643bfd36f7c6e /numpy/distutils/exec_command.py | |
parent | bef927157ffee26ba8af19c773c18b0dbb1897ad (diff) | |
download | numpy-be0803611defdad708eb3e00d7f81846f5c1f436.tar.gz |
DEP: deprecate exec_command
Diffstat (limited to 'numpy/distutils/exec_command.py')
-rw-r--r-- | numpy/distutils/exec_command.py | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/numpy/distutils/exec_command.py b/numpy/distutils/exec_command.py index ede347b03..2e7b9e463 100644 --- a/numpy/distutils/exec_command.py +++ b/numpy/distutils/exec_command.py @@ -57,6 +57,7 @@ import os import sys import subprocess import locale +import warnings from numpy.distutils.misc_util import is_sequence, make_temp_file from numpy.distutils import log @@ -105,6 +106,9 @@ def forward_bytes_to_stdout(val): def temp_file_name(): + # 2019-01-30, 1.17 + warnings.warn('temp_file_name is deprecated since NumPy v1.17, use ' + 'tempfile.mkstemp instead', DeprecationWarning, stacklevel=1) fo, name = make_temp_file() fo.close() return name @@ -179,24 +183,14 @@ def _update_environment( **env ): for name, value in env.items(): os.environ[name] = value or '' -def _supports_fileno(stream): - """ - Returns True if 'stream' supports the file descriptor and allows fileno(). - """ - if hasattr(stream, 'fileno'): - try: - stream.fileno() - return True - except IOError: - return False - else: - return False - def exec_command(command, execute_in='', use_shell=None, use_tee=None, _with_python = 1, **env ): """ Return (status,output) of executed command. + .. deprecated:: 1.17 + Use subprocess.Popen instead + Parameters ---------- command : str @@ -220,6 +214,9 @@ def exec_command(command, execute_in='', use_shell=None, use_tee=None, Wild cards will not work for non-posix systems or when use_shell=0. """ + # 2019-01-30, 1.17 + warnings.warn('exec_command is deprecated since NumPy v1.17, use ' + 'subprocess.Popen instead', DeprecationWarning, stacklevel=1) log.debug('exec_command(%r,%s)' % (command,\ ','.join(['%s=%r'%kv for kv in env.items()]))) |