Skip to content

Commit 3528ded

Browse files
committed
added Windows instructions
1 parent 221b319 commit 3528ded

File tree

6 files changed

+60
-34
lines changed

6 files changed

+60
-34
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@
1212
# Denote all files that are truly binary and should not be modified.
1313
*.png binary
1414
*.jpg binary
15+
16+
**.reg eol=crlf

doc/on-windows/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Preparing development environment on Windows
2+
3+
> Tested on Win7
4+
5+
1. Download and install MSYS2.
6+
7+
2. In MSYS2 console:
8+
9+
pacman -Syu
10+
pacman -S make git python python-pip
11+
12+
3. Use any command in the MSYS2 command prompt.
13+
14+
4. PATCH nodeenv: https://github.com/ekalinin/nodeenv/pull/238
15+
16+
# nano `python -c "import nodeenv; print(nodeenv.__file__)"`
17+
- is_CYGWIN = platform.system().startswith('CYGWIN')
18+
+ is_CYGWIN = platform.system().startswith(('CYGWIN', 'MSYS'))
19+
20+
5. Optional: Apply MSYS2 "Open Here" settings (execute `msys2-here.reg`).
21+
22+
23+

doc/on-windows/git-settings.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
git config --global core.editor nano
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Windows Registry Editor Version 5.00
2+
3+
[-HKEY_CLASSES_ROOT\Directory\Background\shell\open_msys2]
4+
[-HKEY_CLASSES_ROOT\Folder\shell\open_msys2]
5+

doc/on-windows/msys2-here.reg

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Windows Registry Editor Version 5.00
2+
3+
[HKEY_CLASSES_ROOT\Directory\Background\shell\open_msys2]
4+
@="Open MSYS2 here"
5+
6+
[HKEY_CLASSES_ROOT\Directory\Background\shell\open_msys2\command]
7+
@="c:\\msys64\\usr\\bin\\mintty.exe /bin/bash -lc 'cd \"$(cygpath \"%V\")\"; export CHERE_INVOKING=1; exec bash --login -i'"
8+
9+
[HKEY_CLASSES_ROOT\Folder\shell\open_msys2]
10+
@="Open MSYS2 here"
11+
12+
[HKEY_CLASSES_ROOT\Folder\shell\open_msys2\command]
13+
@="c:\\msys64\\usr\\bin\\mintty.exe /bin/bash -lc 'cd \"$(cygpath \"%V\")\"; export CHERE_INVOKING=1; exec bash --login -i'"
14+

doc/using-virtual-environment.md

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -38,46 +38,27 @@
3838

3939
```bash
4040
# For Tmux VirtualEnv support
41-
get_ts_name(){
42-
[[ -n $TMUX ]] && tmux list-panes -F '#{session_name}' | tr '-' '_'
43-
}
44-
45-
get_var(){
46-
echo $(eval echo "\$${1}")
47-
}
48-
49-
tmux_get_myenvvar(){
50-
echo $(get_var "ns_$(get_ts_name)_${1}")
51-
}
52-
53-
tmux_set_envvar(){
54-
# tmux_set_envvar your-session-name variable-name value
55-
local session_name=$(echo $1 | tr '-' '_')
56-
local variable_name=$2
57-
local value=$3
58-
tmux setenv -g "ns_${session_name}_${variable_name}" "$value"
59-
}
60-
61-
tmux_set_venv(){
62-
tmux_set_envvar $1 "VIRTUAL_ENV" $2
63-
}
64-
65-
export -f tmux_set_venv
66-
export -f tmux_set_envvar
67-
export -f tmux_get_myenvvar
68-
69-
tmux_get_myvenv(){
70-
tmux_get_myenvvar "VIRTUAL_ENV"
41+
tmux_get_var(){
42+
local key=$1
43+
tmux showenv | awk -F= -v key="$key" '$1==key {print $2}'
7144
}
7245

7346
# activate the virtual environment if it is declared
74-
if [ -n "$(tmux_get_myvenv)" ]; then
75-
source $(tmux_get_myvenv)/bin/activate;
47+
venv=$(tmux_get_var "VIRTUAL_ENV")
48+
if [ -n "$venv" ]; then
49+
source $venv/bin/activate;
7650
fi
7751
```
7852

79-
2. Add the following line before launching Tmux:
53+
2. Send the following line into a Tmux pane:
54+
55+
```bash
56+
tmux setenv 'VIRTUAL_ENV' /path/to/virtualenv/
57+
```
58+
59+
With `service-runner` library, `run-in-tmux` function can be used:
8060

8161
```bash
82-
tmux_set_venv your-tmux-session-name /path/to/your/venv
62+
venv="${SCADAJS_1_ENV:-"$DIR/scada.js/nodeenv"}"
63+
run-in-tmux "tmux setenv 'VIRTUAL_ENV' $venv && exit"
8364
```

0 commit comments

Comments
 (0)