Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
Remove venv from python template (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianofernandeszup authored Sep 26, 2020
1 parent 9015605 commit 02805d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
2 changes: 2 additions & 0 deletions templates/create_formula/languages/python3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ RUN sed -i 's/\r//g' /rit/set_umask.sh
RUN sed -i 's/\r//g' /rit/run.sh
RUN chmod +x /rit/set_umask.sh

ENV DOCKER_EXECUTION=true

WORKDIR /app
ENTRYPOINT ["/rit/set_umask.sh"]
CMD ["/rit/run.sh"]
20 changes: 4 additions & 16 deletions templates/create_formula/languages/python3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,18 @@ build: python-build sh_unix bat_windows docker
python-build:
mkdir -p $(BIN_FOLDER)
cp -r src/* $(BIN_FOLDER)

# Config VENV
echo '#!/bin/bash' > $(BIN_FOLDER)/$(BIN_CONFIG_VENV)
echo 'python3 -m venv --clear "$$(dirname "$$0")"/venv' >> $(BIN_FOLDER)/$(BIN_CONFIG_VENV)
echo 'source ./"$$(dirname "$$0")"/venv/bin/activate' >> $(BIN_FOLDER)/$(BIN_CONFIG_VENV)
echo 'pip3 install -r "$$(dirname "$$0")"/requirements.txt' >> $(BIN_FOLDER)/$(BIN_CONFIG_VENV)
chmod +x $(BIN_FOLDER)/$(BIN_CONFIG_VENV)
./$(BIN_FOLDER)/$(BIN_CONFIG_VENV)

# Fix lib64
rm ./$(BIN_FOLDER)/venv/lib64
cp -r ./$(BIN_FOLDER)/venv/lib/ ./$(BIN_FOLDER)/venv/lib64
pip3 install -r $(BIN_FOLDER)/requirements.txt

sh_unix:
echo '#!/bin/bash' > $(BIN_FOLDER)/$(BINARY_NAME)
echo 'source "$$(dirname "$$0")"/venv/bin/activate' >> $(BIN_FOLDER)/$(BINARY_NAME)
echo 'if [[ $$DOCKER_EXECUTION ]] ; then' >> $(BIN_FOLDER)/$(BINARY_NAME)
echo ' pip3 install -r "$$(dirname "$$0")"/requirements.txt >> /dev/null' >> $(BIN_FOLDER)/$(BINARY_NAME)
echo 'fi' >> $(BIN_FOLDER)/$(BINARY_NAME)
echo 'python3 "$$(dirname "$$0")"/main.py' >> $(BIN_FOLDER)/$(BINARY_NAME)
echo 'deactivate' >> $(BIN_FOLDER)/$(BINARY_NAME)
chmod +x $(BIN_FOLDER)/$(BINARY_NAME)

bat_windows:
echo '"$$(dirname "$$0")"/venv/bin/activate.bat' >> $(BIN_FOLDER)/$(BINARY_NAME_WINDOWS)
echo 'python main.py' >> $(BIN_FOLDER)/$(BINARY_NAME_WINDOWS)
echo 'deactivate.bat' >> $(BIN_FOLDER)/$(BINARY_NAME_WINDOWS)

docker:
cp Dockerfile set_umask.sh $(BIN_FOLDER)

0 comments on commit 02805d8

Please sign in to comment.