-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_examples.sh
executable file
·56 lines (47 loc) · 1.28 KB
/
create_examples.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/zsh
set -e
PYTHON=/usr/bin/python3
# remove old examples
rm -rf example-*
# Create a basic example
mkdir example-basic
cd example-basic
"$PYTHON" -m virtualenv .venv
echo 'print("hello")' >hello.py
cd ..
# Create an example of nested directories with multiple virtual environments.
mkdir -p example-nested/some/sub/dir
cd example-nested/some
"$PYTHON" -m virtualenv .venv-in-some
cd sub/
"$PYTHON" -m virtualenv .venv-in-sub
cd dir/
echo 'print("hello")' >hello.py
cd ../../../..
# Create a virtual environment which has been
# moved but still has the old location hard-coded.
mkdir old-location
cd old-location
"$PYTHON" -m virtualenv .venv
cd ..
mv old-location example-outdated-location
# Create one with two virtual environments. Which one is found first?
mkdir example-multiple-venvs
cd example-multiple-venvs
"$PYTHON" -m virtualenv .venv1
"$PYTHON" -m virtualenv .venv2
cd ..
# Create one whose parent directory's name contains special characters
mkdir $'example-special \t\n!characters '
cd $'example-special \t\n!characters '
"$PYTHON" -m virtualenv .venv
cd ..
# Create one managed by direnv, if available.
# The plugin should NOT activate in here.
if command -v direnv >/dev/null; then
mkdir example-direnv
cd example-direnv
echo 'layout python3' >.envrc
direnv allow
cd ..
fi