Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Futureproofing: Removing distutils dependencies #5992

Merged
merged 15 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,5 @@ benchmark_histograms/
[._]sw[a-px]
[._]*.sw[a-p]x
[._]sw[a-p]x

**/build/lib/**
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ in development

Added
~~~~~
* Remove `distutils` dependencies across the project. #5992
Contributed by @AndroxxTraxxon
AndroxxTraxxon marked this conversation as resolved.
Show resolved Hide resolved

* Move `git clone` to `user_home/.st2packs` #5845

* Error on `st2ctl status` when running in Kubernetes. #5851
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ distclean: clean

.PHONY: .requirements
.requirements: virtualenv
$(VIRTUALENV_DIR)/bin/pip install --upgrade "pip==$(PIP_VERSION)"
$(VIRTUALENV_DIR)/bin/pip install --upgrade "pip==$(PIP_VERSION)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the trailing slash intentional here?

# Print out pip version
$(VIRTUALENV_DIR)/bin/pip --version
# Generate all requirements to support current CI pipeline.
Expand Down
39 changes: 0 additions & 39 deletions contrib/runners/action_chain_runner/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import re
import sys

from distutils.version import StrictVersion

# NOTE: This script can't rely on any 3rd party dependency so we need to use this code here
#
# TODO: Why can't this script rely on 3rd party dependencies? Is it because it has to import
Expand All @@ -48,50 +46,13 @@
GET_PIP = "curl https://bootstrap.pypa.io/get-pip.py | python"

__all__ = [
"check_pip_is_installed",
"check_pip_version",
"fetch_requirements",
"apply_vagrant_workaround",
"get_version_string",
"parse_version_string",
]


def check_pip_is_installed():
"""
Ensure that pip is installed.
"""
try:
import pip # NOQA
except ImportError as e:
print("Failed to import pip: %s" % (text_type(e)))
print("")
print("Download pip:\n%s" % (GET_PIP))
sys.exit(1)

return True


def check_pip_version(min_version="6.0.0"):
"""
Ensure that a minimum supported version of pip is installed.
"""
check_pip_is_installed()

import pip

if StrictVersion(pip.__version__) < StrictVersion(min_version):
print(
"Upgrade pip, your version '{0}' "
"is outdated. Minimum required version is '{1}':\n{2}".format(
pip.__version__, min_version, GET_PIP
)
)
sys.exit(1)

return True


def fetch_requirements(requirements_file_path):
"""
Return a list of requirements and links by parsing the provided requirements file.
Expand Down
39 changes: 0 additions & 39 deletions contrib/runners/announcement_runner/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import re
import sys

from distutils.version import StrictVersion

# NOTE: This script can't rely on any 3rd party dependency so we need to use this code here
#
# TODO: Why can't this script rely on 3rd party dependencies? Is it because it has to import
Expand All @@ -48,50 +46,13 @@
GET_PIP = "curl https://bootstrap.pypa.io/get-pip.py | python"

__all__ = [
"check_pip_is_installed",
"check_pip_version",
"fetch_requirements",
"apply_vagrant_workaround",
"get_version_string",
"parse_version_string",
]


def check_pip_is_installed():
"""
Ensure that pip is installed.
"""
try:
import pip # NOQA
except ImportError as e:
print("Failed to import pip: %s" % (text_type(e)))
print("")
print("Download pip:\n%s" % (GET_PIP))
sys.exit(1)

return True


def check_pip_version(min_version="6.0.0"):
"""
Ensure that a minimum supported version of pip is installed.
"""
check_pip_is_installed()

import pip

if StrictVersion(pip.__version__) < StrictVersion(min_version):
print(
"Upgrade pip, your version '{0}' "
"is outdated. Minimum required version is '{1}':\n{2}".format(
pip.__version__, min_version, GET_PIP
)
)
sys.exit(1)

return True


def fetch_requirements(requirements_file_path):
"""
Return a list of requirements and links by parsing the provided requirements file.
Expand Down
39 changes: 0 additions & 39 deletions contrib/runners/http_runner/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import re
import sys

from distutils.version import StrictVersion

# NOTE: This script can't rely on any 3rd party dependency so we need to use this code here
#
# TODO: Why can't this script rely on 3rd party dependencies? Is it because it has to import
Expand All @@ -48,50 +46,13 @@
GET_PIP = "curl https://bootstrap.pypa.io/get-pip.py | python"

__all__ = [
"check_pip_is_installed",
"check_pip_version",
"fetch_requirements",
"apply_vagrant_workaround",
"get_version_string",
"parse_version_string",
]


def check_pip_is_installed():
"""
Ensure that pip is installed.
"""
try:
import pip # NOQA
except ImportError as e:
print("Failed to import pip: %s" % (text_type(e)))
print("")
print("Download pip:\n%s" % (GET_PIP))
sys.exit(1)

return True


def check_pip_version(min_version="6.0.0"):
"""
Ensure that a minimum supported version of pip is installed.
"""
check_pip_is_installed()

import pip

if StrictVersion(pip.__version__) < StrictVersion(min_version):
print(
"Upgrade pip, your version '{0}' "
"is outdated. Minimum required version is '{1}':\n{2}".format(
pip.__version__, min_version, GET_PIP
)
)
sys.exit(1)

return True


def fetch_requirements(requirements_file_path):
"""
Return a list of requirements and links by parsing the provided requirements file.
Expand Down
39 changes: 0 additions & 39 deletions contrib/runners/inquirer_runner/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import re
import sys

from distutils.version import StrictVersion

# NOTE: This script can't rely on any 3rd party dependency so we need to use this code here
#
# TODO: Why can't this script rely on 3rd party dependencies? Is it because it has to import
Expand All @@ -48,50 +46,13 @@
GET_PIP = "curl https://bootstrap.pypa.io/get-pip.py | python"

__all__ = [
"check_pip_is_installed",
"check_pip_version",
"fetch_requirements",
"apply_vagrant_workaround",
"get_version_string",
"parse_version_string",
]


def check_pip_is_installed():
"""
Ensure that pip is installed.
"""
try:
import pip # NOQA
except ImportError as e:
print("Failed to import pip: %s" % (text_type(e)))
print("")
print("Download pip:\n%s" % (GET_PIP))
sys.exit(1)

return True


def check_pip_version(min_version="6.0.0"):
"""
Ensure that a minimum supported version of pip is installed.
"""
check_pip_is_installed()

import pip

if StrictVersion(pip.__version__) < StrictVersion(min_version):
print(
"Upgrade pip, your version '{0}' "
"is outdated. Minimum required version is '{1}':\n{2}".format(
pip.__version__, min_version, GET_PIP
)
)
sys.exit(1)

return True


def fetch_requirements(requirements_file_path):
"""
Return a list of requirements and links by parsing the provided requirements file.
Expand Down
39 changes: 0 additions & 39 deletions contrib/runners/local_runner/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import re
import sys

from distutils.version import StrictVersion

# NOTE: This script can't rely on any 3rd party dependency so we need to use this code here
#
# TODO: Why can't this script rely on 3rd party dependencies? Is it because it has to import
Expand All @@ -48,50 +46,13 @@
GET_PIP = "curl https://bootstrap.pypa.io/get-pip.py | python"

__all__ = [
"check_pip_is_installed",
"check_pip_version",
"fetch_requirements",
"apply_vagrant_workaround",
"get_version_string",
"parse_version_string",
]


def check_pip_is_installed():
"""
Ensure that pip is installed.
"""
try:
import pip # NOQA
except ImportError as e:
print("Failed to import pip: %s" % (text_type(e)))
print("")
print("Download pip:\n%s" % (GET_PIP))
sys.exit(1)

return True


def check_pip_version(min_version="6.0.0"):
"""
Ensure that a minimum supported version of pip is installed.
"""
check_pip_is_installed()

import pip

if StrictVersion(pip.__version__) < StrictVersion(min_version):
print(
"Upgrade pip, your version '{0}' "
"is outdated. Minimum required version is '{1}':\n{2}".format(
pip.__version__, min_version, GET_PIP
)
)
sys.exit(1)

return True


def fetch_requirements(requirements_file_path):
"""
Return a list of requirements and links by parsing the provided requirements file.
Expand Down
39 changes: 0 additions & 39 deletions contrib/runners/noop_runner/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import re
import sys

from distutils.version import StrictVersion

# NOTE: This script can't rely on any 3rd party dependency so we need to use this code here
#
# TODO: Why can't this script rely on 3rd party dependencies? Is it because it has to import
Expand All @@ -48,50 +46,13 @@
GET_PIP = "curl https://bootstrap.pypa.io/get-pip.py | python"

__all__ = [
"check_pip_is_installed",
"check_pip_version",
"fetch_requirements",
"apply_vagrant_workaround",
"get_version_string",
"parse_version_string",
]


def check_pip_is_installed():
"""
Ensure that pip is installed.
"""
try:
import pip # NOQA
except ImportError as e:
print("Failed to import pip: %s" % (text_type(e)))
print("")
print("Download pip:\n%s" % (GET_PIP))
sys.exit(1)

return True


def check_pip_version(min_version="6.0.0"):
"""
Ensure that a minimum supported version of pip is installed.
"""
check_pip_is_installed()

import pip

if StrictVersion(pip.__version__) < StrictVersion(min_version):
print(
"Upgrade pip, your version '{0}' "
"is outdated. Minimum required version is '{1}':\n{2}".format(
pip.__version__, min_version, GET_PIP
)
)
sys.exit(1)

return True


def fetch_requirements(requirements_file_path):
"""
Return a list of requirements and links by parsing the provided requirements file.
Expand Down