From 53d051d3ae76e3608be6ddcae81afb61238e1a64 Mon Sep 17 00:00:00 2001 From: Bobby Date: Sat, 5 Nov 2022 10:26:35 -0400 Subject: fix: Fixed Scripts --- commit.sh | 11 ++++++----- requirements.txt | 1 + setup.py | 10 ++++++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/commit.sh b/commit.sh index 7370c0c..8818d46 100755 --- a/commit.sh +++ b/commit.sh @@ -15,8 +15,6 @@ # This script should return 0 if the commit should proceed or 1 if # the commit should be aborted. -!#/bin/sh - set -e # Get the current branch name @@ -35,7 +33,6 @@ helpFuntion() { exit $1 } - # User Defined Commands commands() { # Add commands here @@ -46,10 +43,10 @@ commands() { python3 -m isort . # Format code - python3 black . + python3 -m black . # Generate Requirements.txt - pipreqs --force . + pipreqs ./ --ignore .venv # Generate Maintainers List python3 scripts/maintainers.py @@ -63,6 +60,7 @@ branch=$(git rev-parse --abbrev-ref HEAD) commit() { # Run User Defined Commands commands + # Check if the branch is the current branch if [ "$branch" == "$(git rev-parse --abbrev-ref HEAD)" ] then @@ -79,6 +77,9 @@ commit() { git commit -m "$msg" git push origin $branch fi + + # exit with success + exit 0 } # Check if the number of arguments is less than 2 diff --git a/requirements.txt b/requirements.txt index bee6c14..99f89aa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ +inquirer==2.10.0 PyYAML==6.0 diff --git a/setup.py b/setup.py index 8e69692..57acedd 100644 --- a/setup.py +++ b/setup.py @@ -8,8 +8,6 @@ import os import subprocess import sys -import inquirer - logger.basicConfig(stream=sys.stdout, level=logger.DEBUG) @@ -28,9 +26,17 @@ class Setup: logger.info("Virtual environment activated.") logger.info("Installing requirements...") self.shell_run(self.QUIET_INSTALL) + self.install_pip("black") + self.install_pip("isort") self.git() + def install_pip(self, package_name): + logger.info(f"Installing {package_name}...") + self.shell_run(f"pip install -q {package_name}") + def git(self): + import inquirer + username = self.shell_run("git config --global user.name") if username == "": questions = [ -- cgit v1.2.3