Skip to content

Instantly share code, notes, and snippets.

@ssbarnea
Last active October 9, 2018 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssbarnea/860c50ee73f5018ea3b2a92475401ccb to your computer and use it in GitHub Desktop.
Save ssbarnea/860c50ee73f5018ea3b2a92475401ccb to your computer and use it in GitHub Desktop.

fc28 version:

yum install python-requests python2-urllib3 python-yaml
# .... or python2-requests depends on which repos are active

centos7 version:

dnf install python3-requests python3-urllib3 python3-yaml

proposed install code


function python_cmd() {
    basename $(command -v python3 || command -v python2)
}

$(python_cmd) -m pip --version || \
    (curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"; sudo $(python_cmd) get-pip.py)

if [ "$(python_cmd)" == "python3" ]; then
    sudo $(package_manager) -y install --exclude='python2*' python*-requests python*-urllib3 python*-PyYAML shyaml
else
    sudo $(package_manager) -y install --exclude='python3*' python*-requests python*-urllib3 PyYAML
    which shyaml || \
        sudo $(package_manager) -y install shyaml || \
        sudo $(python_pkg_base) -m pip install shyaml
fi

fc28

[root@fc28 fedora]# yum search pyyaml
Last metadata expiration check: 0:45:05 ago on Tue 09 Oct 2018 07:42:49 AM UTC.
=========================================================================================================================================================================== Name Matched: pyyaml ===========================================================================================================================================================================
python3-PyYAML.x86_64 : YAML parser and emitter for Python
========================================================================================================================================================================= Summary Matched: pyyaml ==========================================================================================================================================================================
python3-yamlordereddictloader.noarch : YAML loader for PyYAML that maintains key order

[root@fc28 fedora]# dnf info python3-PyYAML
Last metadata expiration check: 0:38:37 ago on Tue 09 Oct 2018 07:42:49 AM UTC.
Installed Packages
Name         : python3-PyYAML
Version      : 3.12
Release      : 10.fc28
Arch         : x86_64
Size         : 637 k
Source       : PyYAML-3.12-10.fc28.src.rpm
Repo         : @System
From repo    : anaconda
Summary      : YAML parser and emitter for Python
URL          : http://pyyaml.org/
License      : MIT
Description  : YAML is a data serialization format designed for human readability and
             : interaction with scripting languages.  PyYAML is a YAML parser and
             : emitter for Python.
             :
             : PyYAML features a complete YAML 1.1 parser, Unicode support, pickle
             : support, capable extension API, and sensible error messages.  PyYAML
             : supports standard YAML tags and provides Python-specific tags that
             : allow to represent an arbitrary Python object.
             :
             : PyYAML is applicable for a broad range of tasks from complex
             : configuration files to object serialization and persistance.

cento-7

[root@centos7]# yum info pyyaml
Loaded plugins: etckeeper, langpacks
Installed Packages
Name        : PyYAML
Arch        : x86_64
Version     : 3.10
Release     : 11.el7
Size        : 630 k
Repo        : installed
From repo   : base
Summary     : YAML parser and emitter for Python
URL         : http://pyyaml.org/
License     : MIT
Description : YAML is a data serialization format designed for human readability and
            : interaction with scripting languages.  PyYAML is a YAML parser and
            : emitter for Python.
            :
            : PyYAML features a complete YAML 1.1 parser, Unicode support, pickle
            : support, capable extension API, and sensible error messages.  PyYAML
            : supports standard YAML tags and provides Python-specific tags that
            : allow to represent an arbitrary Python object.
            :
            : PyYAML is applicable for a broad range of tasks from complex
            : configuration files to object serialization and persistance.
            
[root@leno etc]# yum search pyyaml
Loaded plugins: etckeeper, langpacks
=========================================================================================================================================================================== N/S matched: pyyaml ============================================================================================================================================================================
python2-pyyaml.noarch : Dummy package depending on python-pyyaml
PyYAML.x86_64 : YAML parser and emitter for Python
python2-yamlordereddictloader.noarch : YAML loader for PyYAML that maintains key order
python27-PyYAML.x86_64 : YAML parser and emitter for Python
python3-yamlordereddictloader.noarch : YAML loader for PyYAML that maintains key order
python34-PyYAML.x86_64 : YAML parser and emitter for Python 3.4
rh-python35-PyYAML.x86_64 : YAML parser and emitter for Python
rh-python36-PyYAML.x86_64 : YAML parser and emitter for Python

  Name and summary matches only, use "search all" for everything.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment