python3: remove usage of subprocess32
This commit is contained in:
parent
edf8d9763b
commit
dc6b8b6677
13 changed files with 36 additions and 36 deletions
|
|
@ -26,7 +26,7 @@ import os
|
|||
import datetime
|
||||
import logging
|
||||
import Queue
|
||||
import subprocess32
|
||||
import subprocess
|
||||
|
||||
|
||||
from dateutil.parser import parse
|
||||
|
|
@ -359,7 +359,7 @@ class AsyncSubscriber(Subscriber):
|
|||
|
||||
class AsyncSubprocessSubscriber(AsyncSubscriber):
|
||||
"""
|
||||
Subscriber that uses the subprocess32 module to execute a command if an
|
||||
Subscriber that uses the subprocess module to execute a command if an
|
||||
event is received. Events are handled asynchronously::
|
||||
|
||||
subscriber = AsyncSubprocessSubscriber('ls -la', timeout=10)
|
||||
|
|
@ -380,16 +380,16 @@ class AsyncSubprocessSubscriber(AsyncSubscriber):
|
|||
log.debug('Executing command %s.', cmd)
|
||||
|
||||
try:
|
||||
output = subprocess32.check_output(
|
||||
cmd, timeout=timeout, stderr=subprocess32.STDOUT)
|
||||
output = subprocess.check_output(
|
||||
cmd, timeout=timeout, stderr=subprocess.STDOUT)
|
||||
log.debug('Command finished %s', cmd)
|
||||
if output:
|
||||
log.debug('Command output: %s', output)
|
||||
except subprocess32.TimeoutExpired as e:
|
||||
except subprocess.TimeoutExpired as e:
|
||||
log.exception('Timeout while executing command.')
|
||||
if e.output:
|
||||
log.error('Command output: %s', e.output)
|
||||
except subprocess32.CalledProcessError as e:
|
||||
except subprocess.CalledProcessError as e:
|
||||
log.exception('Error while executing command.')
|
||||
if e.output:
|
||||
log.error('Command output: %s', e.output)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
# RhodeCode Enterprise Edition, including its added features, Support services,
|
||||
# and proprietary license terms, please see https://rhodecode.com/licenses/
|
||||
|
||||
from subprocess32 import Popen, PIPE
|
||||
from subprocess import Popen, PIPE
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Checking the chunked data transfer via HTTP
|
|||
|
||||
import os
|
||||
import time
|
||||
import subprocess32
|
||||
import subprocess
|
||||
|
||||
import pytest
|
||||
import requests
|
||||
|
|
@ -53,7 +53,7 @@ def echo_app_chunking(request, available_port_factory):
|
|||
'rhodecode.tests.lib.middleware.utils.test_scm_app_http_chunking'
|
||||
':create_echo_app')
|
||||
command = command.format(port=port)
|
||||
proc = subprocess32.Popen(command.split(' '), bufsize=0)
|
||||
proc = subprocess.Popen(command.split(' '), bufsize=0)
|
||||
echo_app_url = 'http://localhost:' + str(port)
|
||||
|
||||
@request.addfinalizer
|
||||
|
|
@ -78,7 +78,7 @@ def scm_app(request, available_port_factory, echo_app_chunking):
|
|||
command = command.format(port=port)
|
||||
env = os.environ.copy()
|
||||
env["RC_ECHO_URL"] = echo_app_chunking
|
||||
proc = subprocess32.Popen(command.split(' '), bufsize=0, env=env)
|
||||
proc = subprocess.Popen(command.split(' '), bufsize=0, env=env)
|
||||
scm_app_url = 'http://localhost:' + str(port)
|
||||
wait_for_url(scm_app_url)
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import itertools
|
|||
import os
|
||||
import pprint
|
||||
import shutil
|
||||
import subprocess32
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
|
|
@ -77,12 +77,12 @@ def execute(*popenargs, **kwargs):
|
|||
input = kwargs.pop('stdin', None)
|
||||
stdin = None
|
||||
if input:
|
||||
stdin = subprocess32.PIPE
|
||||
stdin = subprocess.PIPE
|
||||
#if 'stderr' not in kwargs:
|
||||
# kwargs['stderr'] = subprocess32.PIPE
|
||||
# kwargs['stderr'] = subprocess.PIPE
|
||||
if 'stdout' in kwargs:
|
||||
raise ValueError('stdout argument not allowed, it will be overridden.')
|
||||
process = subprocess32.Popen(stdin=stdin, stdout=subprocess32.PIPE,
|
||||
process = subprocess.Popen(stdin=stdin, stdout=subprocess.PIPE,
|
||||
*popenargs, **kwargs)
|
||||
output, error = process.communicate(input=input)
|
||||
retcode = process.poll()
|
||||
|
|
@ -91,7 +91,7 @@ def execute(*popenargs, **kwargs):
|
|||
if cmd is None:
|
||||
cmd = popenargs[0]
|
||||
print('{} {} {} '.format(cmd, output, error))
|
||||
raise subprocess32.CalledProcessError(retcode, cmd, output=output)
|
||||
raise subprocess.CalledProcessError(retcode, cmd, output=output)
|
||||
return output
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ To stop the script by press Ctrl-C
|
|||
import datetime
|
||||
import os
|
||||
import psutil
|
||||
import subprocess32
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import traceback
|
||||
|
|
@ -66,7 +66,7 @@ def dump_system():
|
|||
|
||||
|
||||
def count_dulwich_fds(proc):
|
||||
p = subprocess32.Popen(["lsof", "-p", proc.pid], stdout=subprocess32.PIPE)
|
||||
p = subprocess.Popen(["lsof", "-p", proc.pid], stdout=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
|
||||
count = 0
|
||||
|
|
@ -117,7 +117,7 @@ print("VCS - Ok")
|
|||
|
||||
print("\nStarting RhodeCode...")
|
||||
rc = psutil.Popen("RC_VCSSERVER_TEST_DISABLE=1 paster serve test.ini",
|
||||
shell=True, stdin=subprocess32.PIPE)
|
||||
shell=True, stdin=subprocess.PIPE)
|
||||
time.sleep(1)
|
||||
if not rc.is_running():
|
||||
print("RC - Failed to start")
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import functools
|
|||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import subprocess32
|
||||
import subprocess
|
||||
import tempfile
|
||||
import time
|
||||
from itertools import chain
|
||||
|
|
@ -145,8 +145,8 @@ class Repository(object):
|
|||
|
||||
def _run(self, *args):
|
||||
command = [self.BASE_COMMAND] + list(args)
|
||||
process = subprocess32.Popen(
|
||||
command, stdout=subprocess32.PIPE, stderr=subprocess32.PIPE)
|
||||
process = subprocess.Popen(
|
||||
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
return process.communicate()
|
||||
|
||||
def _create_file(self, name, size):
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import re
|
|||
import pprint
|
||||
import shutil
|
||||
import socket
|
||||
import subprocess32
|
||||
import subprocess
|
||||
import time
|
||||
import uuid
|
||||
import dateutil.tz
|
||||
|
|
@ -928,7 +928,7 @@ class RepoServer(object):
|
|||
if vcsrepo.alias != 'svn':
|
||||
raise TypeError("Backend %s not supported" % vcsrepo.alias)
|
||||
|
||||
proc = subprocess32.Popen(
|
||||
proc = subprocess.Popen(
|
||||
['svnserve', '-d', '--foreground', '--listen-host', 'localhost',
|
||||
'--root', vcsrepo.path])
|
||||
self._cleanup_servers.append(proc)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ from os.path import join as jn
|
|||
from os.path import dirname as dn
|
||||
|
||||
from tempfile import _RandomNameSequence
|
||||
from subprocess32 import Popen, PIPE
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
from rhodecode.lib.utils2 import engine_from_config
|
||||
from rhodecode.lib.auth import get_crypt_password
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import os
|
|||
import time
|
||||
import tempfile
|
||||
import pytest
|
||||
import subprocess32
|
||||
import subprocess
|
||||
import configobj
|
||||
import logging
|
||||
from urllib.request import urlopen
|
||||
|
|
@ -152,7 +152,7 @@ class RcVCSServer(ServerBase):
|
|||
log.info('rhodecode-vcsserver command: {}'.format(self.command))
|
||||
log.info('rhodecode-vcsserver logfile: {}'.format(self.log_file))
|
||||
|
||||
self.process = subprocess32.Popen(
|
||||
self.process = subprocess.Popen(
|
||||
self._args, bufsize=0, env=env,
|
||||
stdout=self.server_out, stderr=self.server_out)
|
||||
|
||||
|
|
@ -184,7 +184,7 @@ class RcWebServer(ServerBase):
|
|||
log.info('rhodecode-web command: {}'.format(self.command))
|
||||
log.info('rhodecode-web logfile: {}'.format(self.log_file))
|
||||
|
||||
self.process = subprocess32.Popen(
|
||||
self.process = subprocess.Popen(
|
||||
self._args, bufsize=0, env=env,
|
||||
stdout=self.server_out, stderr=self.server_out)
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import threading
|
|||
import time
|
||||
import logging
|
||||
import os.path
|
||||
import subprocess32
|
||||
import subprocess
|
||||
import tempfile
|
||||
import urllib.request, urllib.error, urllib.parse
|
||||
from lxml.html import fromstring, tostring
|
||||
|
|
@ -223,10 +223,10 @@ def _load_svn_dump_into_repo(dump_name, repo_path):
|
|||
integrated with the main repository once they stabilize more.
|
||||
"""
|
||||
dump = rc_testdata.load_svn_dump(dump_name)
|
||||
load_dump = subprocess32.Popen(
|
||||
load_dump = subprocess.Popen(
|
||||
['svnadmin', 'load', repo_path],
|
||||
stdin=subprocess32.PIPE, stdout=subprocess32.PIPE,
|
||||
stderr=subprocess32.PIPE)
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
out, err = load_dump.communicate(dump)
|
||||
if load_dump.returncode != 0:
|
||||
log.error("Output of load_dump command: %s", out)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
import os
|
||||
import datetime
|
||||
import subprocess32
|
||||
import subprocess
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
@ -86,8 +86,8 @@ class TestGetScm(object):
|
|||
def test_get_two_scms_for_path(self, tmpdir):
|
||||
multialias_repo_path = str(tmpdir)
|
||||
|
||||
subprocess32.check_call(['hg', 'init', multialias_repo_path])
|
||||
subprocess32.check_call(['git', 'init', multialias_repo_path])
|
||||
subprocess.check_call(['hg', 'init', multialias_repo_path])
|
||||
subprocess.check_call(['git', 'init', multialias_repo_path])
|
||||
|
||||
with pytest.raises(VCSError):
|
||||
get_scm(multialias_repo_path)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import os
|
|||
import re
|
||||
import sys
|
||||
|
||||
from subprocess32 import Popen
|
||||
from subprocess import Popen
|
||||
|
||||
|
||||
class VCSTestError(Exception):
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ Base for test suite for making push/pull operations.
|
|||
"""
|
||||
|
||||
from os.path import join as jn
|
||||
from subprocess32 import Popen, PIPE
|
||||
from subprocess import Popen, PIPE
|
||||
import logging
|
||||
import os
|
||||
import tempfile
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue