Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Can't use virtualenv #4033

rmoog ·

Here's my Bash code run as a step:

#!/usr/bin/env bash
set -u

function set_global_vars {
	project_venv_dir="foobar-venv"
	project_git_dir="foobar"
}

function make_venv {
	virtualenv -p $(command -v python2.7) $!{project_venv_dir}
	source $!{project_venv_dir}/bin/activate
		pushd $!{project_git_dir}
			pip install -r dev_requirements.txt
		popd
	deactivate
}

function pylint_scan {
	local result=0
	source $!{project_venv_dir}/bin/activate
		pushd $!{project_git_dir}
			for python_file in $(find . -name \*\.py); do
				echo "Scanning file: $!{python_file}"
				pylint $!{python_file}
				[[ $? -ne 0 ]] && result=1
			done
		popd
	deactivate
	return $!{result}
}

function main {
	set_global_vars
	make_venv
	pylint_scan
	return $?
}

main $@

And here's what output I get:

Command error output: foobar-venv/bin/activate: line 57: PS1: unbound variable

This is triggered by me setting -u in Bash, but I do this so that my stuff will crash if it's written badly, not system stuff. Why does QB not supply a PS1 variable? I'm trying to fix it by adding PS1="" to set_global_vars. Will get back with results.

  • replies 2
  • views 12
  • stars 0
rmoog ·

Yeah. It's really the lack of PS1 and nothing else. PMEase, can we fix this please? :slight_smile:

robinshen ADMIN ·

What build type are you using? Is it "Batch/shell Command" or "Command Line Execution"? Normally "Batch/Shell Command" should be used.