Skip to content

Commit

Permalink
Make installing setuptools configurable (#754)
Browse files Browse the repository at this point in the history
As ROS doesn't like newer setuptools
  • Loading branch information
MatthijsBurgh authored Oct 31, 2024
2 parents 508643a + ecff776 commit c5f167f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.27.3
1.28.0
23 changes: 17 additions & 6 deletions setup/tue-env.bash
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ function tue-env
# Make sure the correct directories are there
mkdir -p "$TUE_DIR"/user/envs

local create_venv targets_url tue_env tue_env_dir venv_include_system_site
local create_venv targets_url tue_env tue_env_dir venv_include_system_site venv_setuptools
create_venv="true"
venv_include_system_site="true"
venv_setuptools="false"

if [[ ${cmd} == "init" ]]
then
Expand All @@ -97,6 +98,8 @@ function tue-env
create_venv="${i#*=}" ;;
--virtualenv-include-system-site-packages=* )
venv_include_system_site="${i#*=}" ;;
--virtualenv-install-setuptools=* )
venv_setuptools="${i#*=}" ;;
--help | -h )
show_help="true"
break
Expand Down Expand Up @@ -125,7 +128,7 @@ function tue-env

if [[ "${show_help}" == "true" ]]
then
echo "Usage: tue-env init NAME [DIRECTORY] [--help|-h] [--targets-url=TARGETS GIT URL] [--create-virtualenv=false|TRUE] [--virtualenv-include-system-site-packages=false|TRUE]"
echo "Usage: tue-env init NAME [DIRECTORY] [--help|-h] [--targets-url=TARGETS_GIT_URL] [--create-virtualenv=false|TRUE] [--virtualenv-include-system-site-packages=false|TRUE] [--virtualenv-install-setuptools=FALSE|true]"
return 1
fi

Expand Down Expand Up @@ -157,7 +160,7 @@ function tue-env

if [[ "${create_venv}" == "true" ]]
then
tue-env init-venv "${tue_env}" --include-system-site-packages="${venv_include_system_site}"
tue-env init-venv "${tue_env}" --include-system-site-packages="${venv_include_system_site}" --install-setuptools="${venv_setuptools}"
fi

elif [[ ${cmd} == "remove" || ${cmd} == "rm" ]]
Expand Down Expand Up @@ -490,8 +493,9 @@ Environment directory '${tue_env_dir}' didn't exist (anymore)"""

elif [[ ${cmd} == "init-venv" ]]
then
local include_system_site tue_env
local include_system_site install_setuptools tue_env
include_system_site="true"
install_setuptools="false"
for i in "$@"
do
case $i in
Expand All @@ -501,6 +505,8 @@ Environment directory '${tue_env_dir}' didn't exist (anymore)"""
;;
--include-system-site-packages=* )
include_system_site="${i#*=}" ;;
--install-setuptools=* )
install_setuptools="${i#*=}" ;;
--* )
echo "[tue-env] Unknown option $i"
show_help="true"
Expand All @@ -522,7 +528,7 @@ Environment directory '${tue_env_dir}' didn't exist (anymore)"""

if [[ ${show_help} == "true" ]]
then
echo "Usage: tue-env init-venv [ENVIRONMENT] [--include-system-site-packages=false|true]"
echo "Usage: tue-env init-venv [ENVIRONMENT] [--include-system-site-packages=false|TRUE] [--install-setuptools=FALSE|true]"
return 1
fi

Expand Down Expand Up @@ -555,7 +561,12 @@ Environment directory '${tue_env_dir}' didn't exist (anymore)"""
then
system_site_args="--system-site-packages"
fi
/usr/bin/python3 -m virtualenv "${venv_dir}" ${system_site_args:+${system_site_args} }--symlinks -q 2>/dev/null
local setuptools_args
if [[ "${install_setuptools}" != "true" ]]
then
setuptools_args="--no-setuptools"
fi
/usr/bin/python3 -m virtualenv "${venv_dir}" ${system_site_args:+${system_site_args} }${setuptools_args:+${setuptools_args} }--symlinks -q 2>/dev/null
echo "[tue-env](init-venv) Initialized virtualenv of environment '${tue_env}'"

if [ "${tue_env}" == "${TUE_ENV}" ]
Expand Down

0 comments on commit c5f167f

Please sign in to comment.