Skip to content

Commit

Permalink
setup.sh: Adjust slightly, remove call to setup_help.py
Browse files Browse the repository at this point in the history
Issue: LINUXEXEC-2547

To avoid any dependencies in setup.sh on 'python', when the --help is used
we want to just call setup.py now.  However, if the user doesn't have python3
we want to warn them and avoid crashing.  This was accomplished by moving the
python checks out of the 'if help' block.

Signed-off-by: Mark Hatle <[email protected]>
  • Loading branch information
Mark Hatle authored and mhatle committed Oct 2, 2019
1 parent 0249034 commit b6b58b7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 74 deletions.
40 changes: 0 additions & 40 deletions bin/setup_help.py

This file was deleted.

60 changes: 26 additions & 34 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ GIT_USEREMAIL="[email protected]"
# Requires python3
CMD="bin/setup.py"

# Only requires python2
CMD_HELP="bin/setup_help.py"

# Adds arguments to the arg processing
# 1 - argument
# 2 - variable to define
Expand Down Expand Up @@ -259,32 +256,6 @@ if [ $help -ne 1 ]; then
fi
done

# The following checks are from oe-buildenv-internal
py_v27_check=$(python2 -c 'import sys; print sys.version_info >= (2,7,3)')
if [ "$py_v27_check" != "True" ]; then
echo >&2 "OpenEmbedded requires 'python2' to be python v2 (>= 2.7.3), not python v3."
echo >&2 "Please upgrade your python v2."
exit 1
fi
unset py_v27_check

# We potentially have code that doesn't parse correctly with older versions
# of Python, and rather than fixing that and being eternally vigilant for
# any other new feature use, just check the version here.
py_v34_check=$(python3 -c 'import sys; print(sys.version_info >= (3,4,0))' 2>/dev/null)
if [ "$py_v34_check" != "True" ]; then
echo >&2 "BitBake requires Python 3.4.0 or later as 'python3'"
exit 1
fi
unset py_v34_check

# This can happen if python3/urllib was not built with SSL support.
python3 -c 'import urllib.request ; dir(urllib.request.HTTPSHandler)' >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo >&2 "The setup tool requires Python 3.4.0 or later with support for 'urllib.request.HTTPSHandler'"
exit 1
fi

repo_check=$(which repo 2>/dev/null)
if [ -z "$repo_check" ]; then
echo >&2 "Repo is not in the path, setup requires the repo tool."
Expand All @@ -297,13 +268,34 @@ if [ $help -ne 1 ]; then
add_gitconfig "color.ui" "false"
add_gitconfig "color.diff" "false"
add_gitconfig "color.status" "false"
else
# If we don't have python3, fall back to the help only version
if ! which python3 &> /dev/null; then
CMD="${CMD_HELP}"
fi
fi # if help -ne 1

# The following checks are from oe-buildenv-internal
py_v27_check=$(python2 -c 'import sys; print sys.version_info >= (2,7,3)')
if [ "$py_v27_check" != "True" ]; then
echo >&2 "OpenEmbedded requires 'python2' to be python v2 (>= 2.7.3), not python v3."
echo >&2 "Please upgrade your python v2."
exit 1
fi
unset py_v27_check

# We potentially have code that doesn't parse correctly with older versions
# of Python, and rather than fixing that and being eternally vigilant for
# any other new feature use, just check the version here.
py_v34_check=$(python3 -c 'import sys; print(sys.version_info >= (3,4,0))' 2>/dev/null)
if [ "$py_v34_check" != "True" ]; then
echo >&2 "BitBake requires Python 3.4.0 or later as 'python3'"
exit 1
fi
unset py_v34_check

# This can happen if python3/urllib was not built with SSL support.
python3 -c 'import urllib.request ; dir(urllib.request.HTTPSHandler)' >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo >&2 "The setup tool requires Python 3.4.0 or later with support for 'urllib.request.HTTPSHandler'"
exit 1
fi

# Python 3 required utf-8 support to work properly, adjust the LANG to en_US.UTF-8.
export LANG='en_US.UTF-8'

Expand Down

0 comments on commit b6b58b7

Please sign in to comment.