Revert "[SWDEV-469278] Lowered PyYAML post install script dependency"
Revert submission 1125402 Reason for revert: Packaging a tar archive of 3rd party sources Reverted Changes: I8908451c0:[SWDEV-482058] Updated Packaging for offline insta... I764c8bf01:[SWDEV-469278] Lowered PyYAML post install script ... Change-Id: I3886b5370e352fc33a249c4657d7ed0c1ee75baf
This commit is contained in:
committed by
Maisam Arif
parent
9924574cbe
commit
6beec5f3ec
+5
-31
@@ -149,7 +149,7 @@ do_install_amdsmi_python_lib() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# upgrade pip if it's an ancient version, typically should not execute
|
# upgrade pip if it's an ancient version
|
||||||
# otherwise the amdsmi install will fail
|
# otherwise the amdsmi install will fail
|
||||||
local pip_version
|
local pip_version
|
||||||
pip_version=$(python3 -m pip --version | grep -Eo '^[^\ ]+ ([0-9]+)' | grep -Eo '[0-9]+$')
|
pip_version=$(python3 -m pip --version | grep -Eo '^[^\ ]+ ([0-9]+)' | grep -Eo '[0-9]+$')
|
||||||
@@ -159,44 +159,18 @@ do_install_amdsmi_python_lib() {
|
|||||||
fi
|
fi
|
||||||
unset pip_version
|
unset pip_version
|
||||||
|
|
||||||
# Check PyYAML dependency, typically should not execute
|
# Check PyYAML dependency
|
||||||
|
local pyyaml_version
|
||||||
pyyaml_version=$(pip show pyyaml | grep -Po '(?<=Version: )[0-9]')
|
pyyaml_version=$(pip show pyyaml | grep -Po '(?<=Version: )[0-9]')
|
||||||
if [[ "$pyyaml_version" -lt 3 ]]; then
|
if [[ "$pyyaml_version" -lt 5 ]]; then
|
||||||
echo "Detected ancient pyyaml version ($pyyaml_version)... Upgrading..."
|
echo "Detected ancient pyyaml version ($pyyaml_version)... Upgrading..."
|
||||||
python3 -m pip install 'PyYAML>=5.1' --quiet --disable-pip-version-check --ignore-installed
|
python3 -m pip install 'PyYAML>=5.1' --quiet --disable-pip-version-check --ignore-installed
|
||||||
fi
|
fi
|
||||||
unset pyyaml_version
|
unset pyyaml_version
|
||||||
|
|
||||||
# Install setuptools wheel (offline install)
|
|
||||||
# Function to find the tarball
|
|
||||||
find_tarball() {
|
|
||||||
find / -name "amdsmi_offline.tar.gz" 2>/dev/null | head -n 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Locate the tarball
|
|
||||||
tarball_path=$(find_tarball)
|
|
||||||
|
|
||||||
if [ -z "$tarball_path" ]; then
|
|
||||||
echo "Error: amdsmi_offline.tar.gz not found."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Extract directory from tarball path
|
|
||||||
base_dir=$(dirname "$tarball_path")
|
|
||||||
|
|
||||||
# Navigate to the directory containing the tarball
|
|
||||||
cd "$base_dir" || exit
|
|
||||||
|
|
||||||
# Unpack the tarball
|
|
||||||
tar -xzvf amdsmi_offline.tar.gz
|
|
||||||
|
|
||||||
# Install setuptools offline (if needed)
|
|
||||||
cd offline_packages || exit
|
|
||||||
python3 -m pip install --upgrade --upgrade-strategy only-if-needed --no-index --find-links=. setuptools
|
|
||||||
|
|
||||||
# install python library at @CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@/amdsmi
|
# install python library at @CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@/amdsmi
|
||||||
local python_lib_path=@CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@
|
local python_lib_path=@CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@
|
||||||
python3 -m pip install "$python_lib_path" --quiet --disable-pip-version-check --no-build-isolation
|
python3 -m pip install "$python_lib_path" --quiet --disable-pip-version-check
|
||||||
|
|
||||||
export PIP_ROOT_USER_ACTION="$PREVIOUS_PIP_ROOT_USER_ACTION"
|
export PIP_ROOT_USER_ACTION="$PREVIOUS_PIP_ROOT_USER_ACTION"
|
||||||
export PIP_BREAK_SYSTEM_PACKAGES="$PREVIOUS_PIP_BREAK_SYSTEM_PACKAGES"
|
export PIP_BREAK_SYSTEM_PACKAGES="$PREVIOUS_PIP_BREAK_SYSTEM_PACKAGES"
|
||||||
|
|||||||
+2
-29
@@ -161,42 +161,15 @@ do_install_amdsmi_python_lib() {
|
|||||||
# Check PyYAML dependency
|
# Check PyYAML dependency
|
||||||
local pyyaml_version
|
local pyyaml_version
|
||||||
pyyaml_version=$(pip show pyyaml | grep -Po '(?<=Version: )[0-9]')
|
pyyaml_version=$(pip show pyyaml | grep -Po '(?<=Version: )[0-9]')
|
||||||
if [[ "$pyyaml_version" -lt 3 ]]; then
|
if [[ "$pyyaml_version" -lt 5 ]]; then
|
||||||
echo "Detected ancient pyyaml version ($pyyaml_version)... Upgrading..."
|
echo "Detected ancient pyyaml version ($pyyaml_version)... Upgrading..."
|
||||||
python3 -m pip install 'PyYAML>=5.1' --quiet --disable-pip-version-check --ignore-installed
|
python3 -m pip install 'PyYAML>=5.1' --quiet --disable-pip-version-check --ignore-installed
|
||||||
fi
|
fi
|
||||||
unset pyyaml_version
|
unset pyyaml_version
|
||||||
|
|
||||||
# Install setuptools wheel (offline install)
|
|
||||||
# Function to find the tarball
|
|
||||||
find_tarball() {
|
|
||||||
find / -name "amdsmi_offline.tar.gz" 2>/dev/null | head -n 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Locate the tarball
|
|
||||||
tarball_path=$(find_tarball)
|
|
||||||
|
|
||||||
if [ -z "$tarball_path" ]; then
|
|
||||||
echo "Error: amdsmi_offline.tar.gz not found."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Extract directory from tarball path
|
|
||||||
base_dir=$(dirname "$tarball_path")
|
|
||||||
|
|
||||||
# Navigate to the directory containing the tarball
|
|
||||||
cd "$base_dir" || exit
|
|
||||||
|
|
||||||
# Unpack the tarball
|
|
||||||
tar -xzvf amdsmi_offline.tar.gz
|
|
||||||
|
|
||||||
# Install setuptools offline (if needed)
|
|
||||||
cd offline_packages || exit
|
|
||||||
python3 -m pip install --upgrade --upgrade-strategy only-if-needed --no-index --find-links=. setuptools
|
|
||||||
|
|
||||||
# install python library at @CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@/amdsmi
|
# install python library at @CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@/amdsmi
|
||||||
local python_lib_path=@CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@
|
local python_lib_path=@CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@
|
||||||
python3 -m pip install "$python_lib_path" --quiet --disable-pip-version-check --no-build-isolation
|
python3 -m pip install "$python_lib_path" --quiet --disable-pip-version-check
|
||||||
|
|
||||||
export PIP_ROOT_USER_ACTION="$PREVIOUS_PIP_ROOT_USER_ACTION"
|
export PIP_ROOT_USER_ACTION="$PREVIOUS_PIP_ROOT_USER_ACTION"
|
||||||
export PIP_BREAK_SYSTEM_PACKAGES="$PREVIOUS_PIP_BREAK_SYSTEM_PACKAGES"
|
export PIP_BREAK_SYSTEM_PACKAGES="$PREVIOUS_PIP_BREAK_SYSTEM_PACKAGES"
|
||||||
|
|||||||
@@ -27,19 +27,10 @@ import time
|
|||||||
from typing import Dict
|
from typing import Dict
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
import yaml
|
import yaml
|
||||||
import inspect
|
|
||||||
|
|
||||||
from amdsmi_helpers import AMDSMIHelpers
|
from amdsmi_helpers import AMDSMIHelpers
|
||||||
import amdsmi_cli_exceptions
|
import amdsmi_cli_exceptions
|
||||||
|
|
||||||
### Custom YAML Functions
|
|
||||||
# Dumper class to preserve order of yaml.dump
|
|
||||||
class CustomDumper(yaml.Dumper):
|
|
||||||
def represent_dict_preserve_order(self, data):
|
|
||||||
return self.represent_dict(data.items())
|
|
||||||
def has_sort_keys_option(): # to check if sort_keys is available
|
|
||||||
return 'sort_keys' in inspect.signature(yaml.dump).parameters
|
|
||||||
|
|
||||||
class AMDSMILogger():
|
class AMDSMILogger():
|
||||||
def __init__(self, format='human_readable', destination='stdout') -> None:
|
def __init__(self, format='human_readable', destination='stdout') -> None:
|
||||||
self.output = {}
|
self.output = {}
|
||||||
@@ -211,15 +202,9 @@ class AMDSMILogger():
|
|||||||
capitalized_json["AMDSMI_SPACING_REMOVAL"] = tabbed_dictionary
|
capitalized_json["AMDSMI_SPACING_REMOVAL"] = tabbed_dictionary
|
||||||
|
|
||||||
json_string = json.dumps(capitalized_json, indent=4)
|
json_string = json.dumps(capitalized_json, indent=4)
|
||||||
|
yaml_data = yaml.safe_load(json_string)
|
||||||
|
yaml_output = yaml.dump(yaml_data, sort_keys=False, allow_unicode=True)
|
||||||
|
|
||||||
if has_sort_keys_option():
|
|
||||||
yaml_data = yaml.safe_load(json_string)
|
|
||||||
yaml_output = yaml.dump(yaml_data, sort_keys=False, allow_unicode=True)
|
|
||||||
else:
|
|
||||||
CustomDumper.add_representer(dict, CustomDumper.represent_dict_preserve_order)
|
|
||||||
yaml_data = yaml.safe_load(json_string)
|
|
||||||
yaml_output = yaml.dump(yaml_data, Dumper=CustomDumper, allow_unicode=True, default_flow_style=False)
|
|
||||||
|
|
||||||
# Remove a key line if it is a spacer
|
# Remove a key line if it is a spacer
|
||||||
yaml_output = yaml_output.replace("AMDSMI_SPACING_REMOVAL:\n", "")
|
yaml_output = yaml_output.replace("AMDSMI_SPACING_REMOVAL:\n", "")
|
||||||
yaml_output = yaml_output.replace("'", "") # Remove ''
|
yaml_output = yaml_output.replace("'", "") # Remove ''
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ readme = {file = "amdsmi/README.md", content-type = "text/markdown"}
|
|||||||
description = "AMDSMI Python LIB - AMD GPU Monitoring Library"
|
description = "AMDSMI Python LIB - AMD GPU Monitoring Library"
|
||||||
requires-python = ">=3.6"
|
requires-python = ">=3.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"PyYAML >= 3.12",
|
"PyYAML >= 5.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ include_package_data = True
|
|||||||
packages = find:
|
packages = find:
|
||||||
python_requires = >=3.6
|
python_requires = >=3.6
|
||||||
install_requires=
|
install_requires=
|
||||||
PyYAML >= 3.12
|
PyYAML >= 5.0
|
||||||
|
|
||||||
[options.package_data]
|
[options.package_data]
|
||||||
* = *.so
|
* = *.so
|
||||||
|
|||||||
Reference in New Issue
Block a user