Skip to content

Commit

Permalink
Update initialization and installation script
Browse files Browse the repository at this point in the history
Unhook version dependencies with changelog-generator
  • Loading branch information
dormant-user committed Apr 11, 2023
1 parent e24e446 commit a15cb72
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 25 deletions.
7 changes: 0 additions & 7 deletions gen_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ set -e

branch="$(git rev-parse --abbrev-ref HEAD)"
checker=$(git diff --name-only `git merge-base $branch HEAD`)
if [[ ! $checker =~ "__init__.py" ]]; then
echo -e "\n********************************************************************ERROR********************************************************************"
echo "Docs generation was ABORTED since module version was not bumped!! Changelog generator requires the commit number and package version in sync."
echo -e "*********************************************************************************************************************************************\n"
exit 255
fi

if [[ ! $checker =~ "release_notes.rst" ]]; then
echo -e "\n********************************************************************ERROR**********************************************************"
echo "Docs generation was ABORTED since release notes was not updated!! Changelog generator requires the release notes to be in sync."
Expand Down
23 changes: 13 additions & 10 deletions jarvis_ui/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import os

from pynotification import pynotifier
version = "0.7"

version = "0.5.4"
install_script = os.path.join(os.path.dirname(__file__), 'lib', 'install.sh')

try:
import pvporcupine # noqa
import pyaudio # noqa
import pvporcupine # noqa: F401
import pyaudio # noqa: F401
import pynotification # noqa: F401
except ImportError as error:
pynotifier(title="First time user?", dialog=True,
message=f"Please run\n\n{os.path.join(os.path.dirname(__file__), 'lib', 'install.sh')}")
raise UserWarning(f"{error.__str__()}\n\nPlease run\n\n"
f"{os.path.join(os.path.dirname(__file__), 'lib', 'install.sh')}")
try:
pynotification.pynotifier(title="First time user?", dialog=True, message=f"Please run\n\n{install_script}")
except NameError:
pass
raise UserWarning(f"{error.__str__()}\n\nPlease run\n\n{install_script}\n\n"
"Note: Shell script will quit for any non-zero exit status, "
"so it might have to be triggered twice.")
else:
from .main import start
start.count = 0
from .main import start # noqa: F401
20 changes: 15 additions & 5 deletions jarvis_ui/lib/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,24 @@ os_independent_packages() {
}

if [[ "$OSName" == "Darwin" ]]; then
xcode-select --install
# Looks for brew installation and installs only if brew is not found in /usr/local/bin
# Looks for xcode installation and installs only if xcode is not found already
which xcodebuild > tmp_xcode && xcode_check=$(cat tmp_xcode) && rm tmp_xcode
if [[ "$xcode_check" == "/usr/bin/xcodebuild" ]] || [[ $HOST == "/*" ]] ; then
xcode_version=$(pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version)
echo "xcode $xcode_version"
else
echo "Installing xcode"
xcode-select --install
fi

# Looks for brew installation and installs only if brew is not found
brew_check=$(which brew)
brew_condition="/usr/local/bin/brew"
if [[ "$brew_check" != "$brew_condition" ]]; then
if [[ "$brew_check" == "/usr/local/bin/brew" ]] || [[ "$brew_check" == "/usr/bin/brew" ]]; then
brew -v > tmp_brew && brew_version=$(head -n 1 tmp_brew) && rm tmp_brew
echo "$brew_version"
else
echo "Installing Homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
else echo "Found Homebrew, skipping installation"
fi
brew install portaudio
python -m pip install PyAudio==0.2.13
Expand Down
2 changes: 1 addition & 1 deletion jarvis_ui/lib/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
packaging==23.0
SpeechRecognition==3.8.1 # Do not upgrade, no functional upgrade in latest version
pyttsx3==2.90
inflect==6.0.2
inflect==6.0.4
requests>=2.28.2
pydantic[dotenv,email]==1.10.7
PyYAML
Expand Down
7 changes: 5 additions & 2 deletions jarvis_ui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ def start():
"""
# Import within a function to be called repeatedly
from jarvis_ui.modules.models import env
logger.info(f"Restart set to {time_converter(second=env.restart_timer)}")
logger.info(f"Restart timer set to {time_converter(second=env.restart_timer)}")
status_manager = Manager().dict()
status_manager["LOCKED"] = False # Instantiate DictProxy
process = Process(target=initiator, args=(status_manager,))
process.name = pathlib.Path(__file__).stem
process.start()
logger.info(f"Initiating as {process.name}[{process.pid}]")
logger.info(f"Initiating as {process.name} [{process.pid}]")
start_time = time.time()
while True:
if start_time + env.restart_timer <= time.time():
Expand Down Expand Up @@ -89,3 +89,6 @@ def start():
break
time.sleep(0.5)
start()


start.count = 0
5 changes: 5 additions & 0 deletions release_notes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Release Notes
=============

0.5.5 (04/10/2023)
------------------
- Update initialization and installation script
- Unhook version dependencies with changelog-generator

0.5.4 (03/22/2023)
------------------
- Fix interactive mode on Windows OS
Expand Down

0 comments on commit a15cb72

Please sign in to comment.