Skip to content

Commit

Permalink
Remove distutils
Browse files Browse the repository at this point in the history
This removes all distutils usage.
  • Loading branch information
tobias-urdin committed Aug 9, 2024
1 parent d37bae2 commit 8bdad64
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 60 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN apt-get update -y && apt-get install -qy gnupg software-properties-common
RUN add-apt-repository -y ppa:deadsnakes/ppa
RUN apt-get -qq update -y \
&& apt-get install -y mysql-server redis-server zookeeper nodejs npm ceph librados-dev \
python3 python3-dev python3-pip python3.9 python3.9-dev python3.9-distutils \
python3 python3-dev python3-pip python3.9 python3.9-dev \
gcc liberasurecode-dev liberasurecode1 postgresql libpq-dev python3-rados git wget memcached \
&& rm -rf /var/lib/apt/lists/*

Expand Down
4 changes: 2 additions & 2 deletions pifpaf/drivers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
import os
import re
import select
import shutil
import socket
import subprocess
import sys
import threading
import time
from distutils import spawn

import fixtures

Expand Down Expand Up @@ -102,7 +102,7 @@ def _kill(self, parent):
def find_executable(filename, extra_paths):
paths = extra_paths + os.getenv('PATH', os.defpath).split(os.pathsep)
for path in paths:
loc = spawn.find_executable(filename, path)
loc = shutil.which(filename, path=path):
if loc is not None:
return loc

Expand Down
16 changes: 8 additions & 8 deletions pifpaf/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import os
import signal
import subprocess
from distutils import spawn
import shutil

import fixtures

Expand All @@ -23,7 +23,7 @@

class TestCli(testtools.TestCase):

@testtools.skipUnless(spawn.find_executable("memcached"),
@testtools.skipUnless(shutil.which("memcached"),
"memcached not found")
def test_cli(self):
self.assertEqual(0, os.system(
Expand All @@ -39,7 +39,7 @@ def _read_stdout_and_kill(stdout):
signal.SIGTERM)
return env

@testtools.skipUnless(spawn.find_executable("memcached"),
@testtools.skipUnless(shutil.which("memcached"),
"memcached not found")
def test_eval(self):
c = subprocess.Popen(["pifpaf", "run", "memcached", "--port", "11219"],
Expand All @@ -53,7 +53,7 @@ def test_eval(self):
self.assertEqual(b"\"memcached://localhost:11219\";",
env[b"export PIFPAF_MEMCACHED_URL"])

@testtools.skipUnless(spawn.find_executable("memcached"),
@testtools.skipUnless(shutil.which("memcached"),
"memcached not found")
def test_exit_code(self):
c = subprocess.Popen(["pifpaf", "run", "memcached", "--port", "11234",
Expand All @@ -62,7 +62,7 @@ def test_exit_code(self):
(stdout, stderr) = c.communicate()
self.assertEqual(31, c.wait())

@testtools.skipUnless(spawn.find_executable("memcached"),
@testtools.skipUnless(shutil.which("memcached"),
"memcached not found")
def test_env_prefix(self):
c = subprocess.Popen(["pifpaf", "run",
Expand All @@ -81,7 +81,7 @@ def test_env_prefix(self):
self.assertEqual(env[b"export PIFPAF_PID"],
env[b"export FOOBAR_PID"])

@testtools.skipUnless(spawn.find_executable("memcached"),
@testtools.skipUnless(shutil.which("memcached"),
"memcached not found")
def test_env_prefix_old_format(self):
# Old format
Expand All @@ -101,7 +101,7 @@ def test_env_prefix_old_format(self):
self.assertEqual(env[b"export PIFPAF_PID"],
env[b"export FOOBAR_PID"])

@testtools.skipUnless(spawn.find_executable("memcached"),
@testtools.skipUnless(shutil.which("memcached"),
"memcached not found")
def test_global_urls_variable(self):
c = subprocess.Popen(["pifpaf", "run",
Expand All @@ -124,7 +124,7 @@ def test_global_urls_variable(self):
b"\"memcached://localhost:11217;memcached://localhost:11218\";",
env[b"export PIFPAF_URLS"])

@testtools.skipUnless(spawn.find_executable("memcached"),
@testtools.skipUnless(shutil.which("memcached"),
"memcached not found")
def test_global_urls_variable_old_format(self):
c = subprocess.Popen(["pifpaf",
Expand Down
Loading

0 comments on commit 8bdad64

Please sign in to comment.