Skip to content

Commit 60fd3f0

Browse files
haadrJoshuaWatt
authored andcommitted
Add ability to disable using a python venv to run whisk
In some scenarios it's undesirable to have a requirement on python virtual environments and using pip to download dependencies at on-demand, for instance when building in a restricted CI environment. This change let's users set the WHISK_NO_VENV shell variable to prevent the usage of python virtual environment and pip to install python dependencies required by whisk.py. The user must then make sure that these dependencies are available some other way, for instance by installing them via the system's native package manager.
1 parent 64f6e9c commit 60fd3f0

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,18 @@ OpenEmbedded and the Yocto project. The key features are:
3333
## Requirements
3434

3535
Whisk is primarily written in Python, with a small initialization shell script
36-
to setup the build environment. The Python code runs under
36+
to setup the build environment. By default, the Python code runs under
3737
[virtualenv](https://virtualenv.pypa.io/en/latest/) and the initialization
3838
script will use it to automatically install the required dependencies. See the
3939
virtualenv documentation for installation instructions.
4040

41+
If you wish to avoid the usage of virtualenv, for instance because you run the
42+
initialization shell script in a restricted environment where downloading
43+
dependencies is not possible, you may set the `WHISK_NO_VENV` environment
44+
variable. The value does not matter, only that it is set. In that case, you
45+
yourself must ensure that the required dependencies are available. See
46+
[requirements.txt](/requirements.txt) for the list of dependencies.
47+
4148
[Using Whisk]: #using-whisk
4249
## Using Whisk
4350

bin/whisk

+10-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
set -eu
1817
THIS_DIR="$(dirname $0)"
19-
exec "$THIS_DIR/whiskenv" "$THIS_DIR/../whisk.py" "$@"
18+
WHISKENV="$THIS_DIR/whiskenv"
19+
20+
if [ ! -z "${WHISK_NO_VENV}" ]; then
21+
echo "Not using python venv, make sure you have the necessary packages installed as system packages."
22+
set -eu
23+
exec "$THIS_DIR/../whisk.py" "$@"
24+
else
25+
set -eu
26+
exec ${WHISKENV} "$THIS_DIR/../whisk.py" "$@"
27+
fi

0 commit comments

Comments
 (0)