Skip to content
Browse files

Make venv activate less bash-centric

Set up the workspace using the current shell, which requires extra
effort because make default to sh. Customize the filename to source
when activating the venv by relaying on PYTHON_VENV_ACTIVATE_SUFFIX
being defined in the environment.
  • Loading branch information
lovett committed Jan 1, 2020
1 parent 0913aa9 commit bf3e449af16da307ea5f500ad9750dac624d1688
Showing with 7 additions and 6 deletions.
  1. +7 −6 Makefile
@@ -40,6 +40,8 @@ SHARED_JS_DIR := $(CURDIR)/apps/shared/static/js



vpath %.cov coverage

export PATH := ./venv/bin:$(PATH)
@@ -57,7 +59,7 @@ venv: dummy
@rm -rf venv
@python3 -m venv --system-site-packages venv
@echo "done."
@echo "Now run: source venv/bin/activate"
@echo "Now run: source $(VENV_ACTIVATE)"
@echo "After that, run: make setup"
@echo "Also consider running: make hooks"

@@ -330,16 +332,15 @@ master-to-production: dummy
# Automation for setting up a tmux session
# 0: Editor
tmux new-session -d -s "$(TMUX_SESSION_NAME)" bash
tmux new-session -d -s "$(TMUX_SESSION_NAME)" "$$SHELL"
tmux send-keys -t "$(TMUX_SESSION_NAME)" "$(EDITOR) ." C-m

# 1: Shell
tmux new-window -a -t "$(TMUX_SESSION_NAME)" bash
tmux send-keys -t "$(TMUX_SESSION_NAME)" "source venv/bin/activate" C-m
tmux new-window -a -t "$(TMUX_SESSION_NAME)" "$$SHELL"
tmux send-keys -t "$(TMUX_SESSION_NAME)" "source $(VENV_ACTIVATE)" C-m

# 2: Dev server
tmux new-window -a -t "$(TMUX_SESSION_NAME)" -n "devserver" "source venv/bin/activate; make serve"

tmux new-window -a -t "$(TMUX_SESSION_NAME)" -n "devserver" "source $(VENV_ACTIVATE); make serve"
tmux select-window -t "$(TMUX_SESSION_NAME)":0
tmux attach-session -t "$(TMUX_SESSION_NAME)"

0 comments on commit bf3e449

Please sign in to comment.
You can’t perform that action at this time.