forked from PyCQA/isort
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.env
95 lines (75 loc) · 1.83 KB
/
.env
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
OPEN_PROJECT_NAME="isort"
if [ "$PROJECT_NAME" = "$OPEN_PROJECT_NAME" ]; then
return
fi
if [ ! -f ".env" ]; then
return
fi
export PROJECT_NAME=$OPEN_PROJECT_NAME
export PROJECT_DIR="$PWD"
if [ ! -d "venv" ]; then
if ! hash pyvenv 2>/dev/null; then
function pyvenv()
{
if hash pyvenv-3.5 2>/dev/null; then
pyvenv-3.5 $@
fi
if hash pyvenv-3.4 2>/dev/null; then
pyvenv-3.4 $@
fi
if hash pyvenv-3.3 2>/dev/null; then
pyvenv-3.3 $@
fi
if hash pyvenv-3.2 2>/dev/null; then
pyvenv-3.2 $@
fi
}
fi
echo "Making venv for $PROJECT_NAME"
pyvenv venv
. venv/bin/activate
python setup.py install
pip install -r requirements.txt
fi
. venv/bin/activate
# Let's make sure this is a hubflow enabled repo
yes | git hf init >/dev/null 2>/dev/null
# Quick directory switching
alias root="cd $PROJECT_DIR"
alias project="root; cd $PROJECT_NAME"
# Commands
alias test="root; py.test test_isort.py -s"
alias install="_install_project"
alias distribute="python setup.py sdist upload; python setup.py bdist_wheel upload"
alias leave="_leave_project"
function _install_project()
{
CURRENT_DIRECTORY="$PWD"
root
sudo python setup.py install
cp isort_kate_plugin.py ~/.kde/share/apps/kate/pate/isort_plugin.py >/dev/null 2>/dev/null
cd $CURRENT_DIRECTORY
}
function load {
(root
python setup.py install)
}
function interact {
(load
ipython -c "import isort" -i)
}
function _leave_project()
{
export PROJECT_NAME=""
export PROJECT_DIR=""
unalias root
unalias project
unalias test
unalias install
unalias distribute
unalias leave
unset -f load
unset -f interact
deactivate
}