Skip to content

Commit

Permalink
Move the venv logic into r2ai.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed May 14, 2024
1 parent a9fecdd commit 44982c2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ endif
.PHONY: install uninstall user-install user-uninstall

all: venv
. venv/bin/activate ; $(PYTHON) main.py
# || $(MAKE) deps
./r2ai.sh

large:
. venv/bin/activate ; $(PYTHON) main.py -l
Expand Down Expand Up @@ -50,7 +49,7 @@ vectordb:

install user-install:
ln -fs $(PWD)/main.py $(R2_USER_PLUGINS)/r2ai.py
ln -fs $(PWD)/main.py $(R2PM_BINDIR)/r2ai
ln -fs $(PWD)/r2ai.sh $(R2PM_BINDIR)/r2ai
$(MAKE) -C native/cxx user-uninstall

uninstall user-uninstall:
Expand Down
17 changes: 17 additions & 0 deletions r2ai.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
PYTHON=python3
if [ -h "$0" ]; then
F=`readlink $0`
else
F="$0"
fi
D=`dirname $0`
[ -n "$D" ] && cd "$D"
if [ ! -d venv ]; then
$PYTHON -m venv venv
. venv/bin/activate
pip3 install -r requirements.txt
else
. venv/bin/activate
fi
$PYTHON main.py $@

0 comments on commit 44982c2

Please sign in to comment.