Skip to content

Commit

Permalink
Display prompt instead of exiting installation for untested
Browse files Browse the repository at this point in the history
Update GH action runner for markdown validations
Update labels and hyperlinks in README.md
  • Loading branch information
dormant-user committed Jun 22, 2024
1 parent c5b7a51 commit d833150
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ name: none-shall-pass

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
push:
branches:
- master

jobs:
none-shall-pass:
runs-on: thevickypedia-default
runs-on: thevickypedia-lite
steps:
- uses: actions/checkout@v4
- uses: thevickypedia/none-shall-pass@v5
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ Licensed under the [MIT License][license]
[release-notes]: https://github.com/thevickypedia/Jarvis/blob/master/release_notes.rst
[gha_pages]: https://github.com/thevickypedia/Jarvis/actions/workflows/pages/pages-build-deployment
[gha_pypi]: https://github.com/thevickypedia/Jarvis/actions/workflows/python-publish.yml
[gha_md_valid]: https://github.com/thevickypedia/Jarvis/actions/workflows/markdown-validation.yml
[gha_md_valid]: https://github.com/thevickypedia/Jarvis/actions/workflows/markdown.yml
[gha_cleanup]: https://github.com/thevickypedia/Jarvis/actions/workflows/cleanup.yml
[webpage]: https://vigneshrao.com/
[webpage_contact]: https://vigneshrao.com/contact
Expand Down Expand Up @@ -253,7 +253,7 @@ Licensed under the [MIT License][license]

[label-actions-pages]: https://github.com/thevickypedia/Jarvis/actions/workflows/pages/pages-build-deployment/badge.svg
[label-actions-pypi]: https://github.com/thevickypedia/Jarvis/actions/workflows/python-publish.yml/badge.svg
[label-actions-markdown]: https://github.com/thevickypedia/Jarvis/actions/workflows/markdown-validation.yml/badge.svg
[label-actions-markdown]: https://github.com/thevickypedia/Jarvis/actions/workflows/markdown.yml/badge.svg
[label-actions-cleanup]: https://github.com/thevickypedia/Jarvis/actions/workflows/cleanup.yml/badge.svg

[label-pypi]: https://img.shields.io/pypi/v/jarvis-ironman
Expand Down
2 changes: 1 addition & 1 deletion docs/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ <h2 align="center">Voice-Activated Natural Language UI</h2><p><a class="referenc
<p><strong>Deployments</strong></p>
<p><a class="reference external" href="https://github.com/thevickypedia/Jarvis/actions/workflows/pages/pages-build-deployment"><img alt="pages" src="https://github.com/thevickypedia/Jarvis/actions/workflows/pages/pages-build-deployment/badge.svg" /></a>
<a class="reference external" href="https://github.com/thevickypedia/Jarvis/actions/workflows/python-publish.yml"><img alt="pypi" src="https://github.com/thevickypedia/Jarvis/actions/workflows/python-publish.yml/badge.svg" /></a></p>
<p><a class="reference external" href="https://github.com/thevickypedia/Jarvis/actions/workflows/markdown-validation.yml"><img alt="markdown" src="https://github.com/thevickypedia/Jarvis/actions/workflows/markdown-validation.yml/badge.svg" /></a>
<p><a class="reference external" href="https://github.com/thevickypedia/Jarvis/actions/workflows/markdown.yml"><img alt="markdown" src="https://github.com/thevickypedia/Jarvis/actions/workflows/markdown.yml/badge.svg" /></a>
<a class="reference external" href="https://github.com/thevickypedia/Jarvis/actions/workflows/cleanup.yml"><img alt="cleanup" src="https://github.com/thevickypedia/Jarvis/actions/workflows/cleanup.yml/badge.svg" /></a></p>
<p><a class="reference external" href="https://pypi.org/project/jarvis-ironman"><img alt="Pypi" src="https://img.shields.io/pypi/v/jarvis-ironman" /></a>
<a class="reference external" href="https://pypi.org/project/jarvis-ironman/#files"><img alt="Pypi-format" src="https://img.shields.io/pypi/format/jarvis-ironman" /></a>
Expand Down
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ Licensed under the [MIT License][license]
[release-notes]: https://github.com/thevickypedia/Jarvis/blob/master/release_notes.rst
[gha_pages]: https://github.com/thevickypedia/Jarvis/actions/workflows/pages/pages-build-deployment
[gha_pypi]: https://github.com/thevickypedia/Jarvis/actions/workflows/python-publish.yml
[gha_md_valid]: https://github.com/thevickypedia/Jarvis/actions/workflows/markdown-validation.yml
[gha_md_valid]: https://github.com/thevickypedia/Jarvis/actions/workflows/markdown.yml
[gha_cleanup]: https://github.com/thevickypedia/Jarvis/actions/workflows/cleanup.yml
[webpage]: https://vigneshrao.com/
[webpage_contact]: https://vigneshrao.com/contact
Expand Down Expand Up @@ -253,7 +253,7 @@ Licensed under the [MIT License][license]

[label-actions-pages]: https://github.com/thevickypedia/Jarvis/actions/workflows/pages/pages-build-deployment/badge.svg
[label-actions-pypi]: https://github.com/thevickypedia/Jarvis/actions/workflows/python-publish.yml/badge.svg
[label-actions-markdown]: https://github.com/thevickypedia/Jarvis/actions/workflows/markdown-validation.yml/badge.svg
[label-actions-markdown]: https://github.com/thevickypedia/Jarvis/actions/workflows/markdown.yml/badge.svg
[label-actions-cleanup]: https://github.com/thevickypedia/Jarvis/actions/workflows/cleanup.yml/badge.svg

[label-pypi]: https://img.shields.io/pypi/v/jarvis-ironman
Expand Down
4 changes: 2 additions & 2 deletions docs/_sources/README.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ Licensed under the [MIT License][license]
[release-notes]: https://github.com/thevickypedia/Jarvis/blob/master/release_notes.rst
[gha_pages]: https://github.com/thevickypedia/Jarvis/actions/workflows/pages/pages-build-deployment
[gha_pypi]: https://github.com/thevickypedia/Jarvis/actions/workflows/python-publish.yml
[gha_md_valid]: https://github.com/thevickypedia/Jarvis/actions/workflows/markdown-validation.yml
[gha_md_valid]: https://github.com/thevickypedia/Jarvis/actions/workflows/markdown.yml
[gha_cleanup]: https://github.com/thevickypedia/Jarvis/actions/workflows/cleanup.yml
[webpage]: https://vigneshrao.com/
[webpage_contact]: https://vigneshrao.com/contact
Expand Down Expand Up @@ -253,7 +253,7 @@ Licensed under the [MIT License][license]

[label-actions-pages]: https://github.com/thevickypedia/Jarvis/actions/workflows/pages/pages-build-deployment/badge.svg
[label-actions-pypi]: https://github.com/thevickypedia/Jarvis/actions/workflows/python-publish.yml/badge.svg
[label-actions-markdown]: https://github.com/thevickypedia/Jarvis/actions/workflows/markdown-validation.yml/badge.svg
[label-actions-markdown]: https://github.com/thevickypedia/Jarvis/actions/workflows/markdown.yml/badge.svg
[label-actions-cleanup]: https://github.com/thevickypedia/Jarvis/actions/workflows/cleanup.yml/badge.svg

[label-pypi]: https://img.shields.io/pypi/v/jarvis-ironman
Expand Down
16 changes: 8 additions & 8 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -2500,15 +2500,17 @@ <h2 id="N">N</h2>
<li><a href="index.html#jarvis.modules.exceptions.no_alsa_err">no_alsa_err() (in module jarvis.modules.exceptions)</a>
</li>
<li><a href="index.html#jarvis.modules.utils.support.no_env_vars">no_env_vars() (in module jarvis.modules.utils.support)</a>
</li>
<li><a href="index.html#jarvis.lib.installer.no_venv">no_venv() (in module jarvis.lib.installer)</a>
</li>
<li><a href="index.html#jarvis.modules.models.classes.RecognizerSettings.non_speaking_duration">non_speaking_duration (jarvis.modules.models.classes.RecognizerSettings attribute)</a>
</li>
<li><a href="index.html#jarvis.modules.models.classes.StartupOptions.none">none (jarvis.modules.models.classes.StartupOptions attribute)</a>
</li>
<li><a href="index.html#jarvis.executors.static_responses.not_allowed_offline">not_allowed_offline() (in module jarvis.executors.static_responses)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#jarvis.executors.static_responses.not_allowed_offline">not_allowed_offline() (in module jarvis.executors.static_responses)</a>
</li>
<li><a href="index.html#jarvis.modules.models.classes.FileIO.notes">notes (jarvis.modules.models.classes.FileIO attribute)</a>
</li>
<li><a href="index.html#jarvis.executors.others.notes">notes() (in module jarvis.executors.others)</a>
Expand Down Expand Up @@ -3359,16 +3361,14 @@ <h2 id="U">U</h2>
<li><a href="index.html#jarvis.executors.car.Operations.unlock">unlock() (jarvis.executors.car.Operations method)</a>
</li>
<li><a href="index.html#jarvis.modules.utils.support.unrecognized_dumper">unrecognized_dumper() (in module jarvis.modules.utils.support)</a>
</li>
<li><a href="index.html#jarvis.lib.installer.unsupported_arch">unsupported_arch() (in module jarvis.lib.installer)</a>
</li>
<li><a href="index.html#jarvis.lib.installer.unsupported_env">unsupported_env() (in module jarvis.lib.installer)</a>
</li>
<li><a href="index.html#jarvis.modules.utils.support.unsupported_features">unsupported_features() (in module jarvis.modules.utils.support)</a>
</li>
<li><a href="index.html#jarvis.lib.installer.unsupported_os">unsupported_os() (in module jarvis.lib.installer)</a>
</li>
<li><a href="index.html#jarvis.modules.exceptions.UnsupportedOS">UnsupportedOS</a>
</li>
<li><a href="index.html#jarvis.lib.installer.untested_arch">untested_arch() (in module jarvis.lib.installer)</a>
</li>
<li><a href="index.html#jarvis.lib.installer.untested_os">untested_os() (in module jarvis.lib.installer)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
Expand Down
26 changes: 8 additions & 18 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ <h1>Jarvis - Voice-Activated Natural Language UI<a class="headerlink" href="#jar
<dd><p>Classify system architecture into known categories.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>Returns exit code 1 if architecture is unknown.</p>
<dd class="field-odd"><p>Returns exit code 1 if no architecture was detected.</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="jarvis.lib.installer.confirmation_prompt">
<span class="sig-prename descclassname"><span class="pre">jarvis.lib.installer.</span></span><span class="sig-name descname"><span class="pre">confirmation_prompt</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#jarvis.lib.installer.confirmation_prompt" title="Permalink to this definition">¶</a></dt>
<span class="sig-prename descclassname"><span class="pre">jarvis.lib.installer.</span></span><span class="sig-name descname"><span class="pre">confirmation_prompt</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">None</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">NoReturn</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#jarvis.lib.installer.confirmation_prompt" title="Permalink to this definition">¶</a></dt>
<dd><p>Prompts a confirmation from the user to continue or exit.</p>
</dd></dl>

Expand Down Expand Up @@ -162,30 +162,20 @@ <h1>Jarvis - Voice-Activated Natural Language UI<a class="headerlink" href="#jar
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="jarvis.lib.installer.unsupported_os">
<span class="sig-prename descclassname"><span class="pre">jarvis.lib.installer.</span></span><span class="sig-name descname"><span class="pre">unsupported_os</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">NoReturn</span></span></span><a class="headerlink" href="#jarvis.lib.installer.unsupported_os" title="Permalink to this definition">¶</a></dt>
<dt class="sig sig-object py" id="jarvis.lib.installer.untested_os">
<span class="sig-prename descclassname"><span class="pre">jarvis.lib.installer.</span></span><span class="sig-name descname"><span class="pre">untested_os</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">None</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">NoReturn</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#jarvis.lib.installer.untested_os" title="Permalink to this definition">¶</a></dt>
<dd><p>Function to handle unsupported operating systems.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>Returns exit code 1 if operating system is not either Linux, macOS or Windows.</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="jarvis.lib.installer.unsupported_arch">
<span class="sig-prename descclassname"><span class="pre">jarvis.lib.installer.</span></span><span class="sig-name descname"><span class="pre">unsupported_arch</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">NoReturn</span></span></span><a class="headerlink" href="#jarvis.lib.installer.unsupported_arch" title="Permalink to this definition">¶</a></dt>
<dt class="sig sig-object py" id="jarvis.lib.installer.untested_arch">
<span class="sig-prename descclassname"><span class="pre">jarvis.lib.installer.</span></span><span class="sig-name descname"><span class="pre">untested_arch</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">None</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">NoReturn</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#jarvis.lib.installer.untested_arch" title="Permalink to this definition">¶</a></dt>
<dd><p>Function to handle unsupported architecture.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>Returns exit code 1 if architecture is not AMD.</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="jarvis.lib.installer.unsupported_env">
<span class="sig-prename descclassname"><span class="pre">jarvis.lib.installer.</span></span><span class="sig-name descname"><span class="pre">unsupported_env</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#jarvis.lib.installer.unsupported_env" title="Permalink to this definition">¶</a></dt>
<dt class="sig sig-object py" id="jarvis.lib.installer.no_venv">
<span class="sig-prename descclassname"><span class="pre">jarvis.lib.installer.</span></span><span class="sig-name descname"><span class="pre">no_venv</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">None</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">NoReturn</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#jarvis.lib.installer.no_venv" title="Permalink to this definition">¶</a></dt>
<dd><p>Function to handle installations that are NOT on virtual environments.</p>
</dd></dl>

Expand Down
Binary file modified docs/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

65 changes: 32 additions & 33 deletions jarvis/lib/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_arch() -> str | NoReturn:
"""Classify system architecture into known categories.
Returns:
Returns exit code 1 if architecture is unknown.
Returns exit code 1 if no architecture was detected.
"""
machine: str = platform.machine().lower()
if "aarch64" in machine or "arm64" in machine:
Expand All @@ -62,17 +62,23 @@ def get_arch() -> str | NoReturn:
architecture: str = "armv6"
elif "armv7" in machine:
architecture: str = "armv7"
elif machine:
architecture: str = machine
else:
logger.info(pretext())
logger.info(center(f"Unknown Architecture: {machine}"))
logger.info(center("Unable to detect system architecture!!"))
logger.info(pretext())
exit(1)
return architecture


def confirmation_prompt() -> None:
def confirmation_prompt() -> None | NoReturn:
"""Prompts a confirmation from the user to continue or exit."""
prompt = input("Are you sure you want to continue? <Y/N> ")
try:
prompt = input("Are you sure you want to continue? <Y/N> ")
except KeyboardInterrupt:
prompt = "N"
print()
if not re.match(r"^[yY](es)?$", prompt):
logger.info(pretext())
logger.info("Bye. Hope to see you soon.")
Expand Down Expand Up @@ -157,43 +163,37 @@ def windows_caveat() -> None | NoReturn:
* Git: https://git-scm.com/download/win/
"""
)
logger.info(pretext())
logger.info(pretext())
logger.warning(f"\n{pretext()}\n{pretext()}\n")
confirmation_prompt()


def unsupported_os() -> NoReturn:
"""Function to handle unsupported operating systems.
Returns:
Returns exit code 1 if operating system is not either Linux, macOS or Windows.
"""
def untested_os() -> None | NoReturn:
"""Function to handle unsupported operating systems."""
logger.warning(f"\n{pretext()}\n{pretext()}\n")
logger.warning(f"Current Operating System: {env.osname}")
logger.warning("Jarvis is currently supported only on Linux, macOS and Windows")
logger.warning("Jarvis has currently been tested only on Linux, macOS and Windows")
logger.warning(
center("Please note that you might need to install additional dependencies.")
)
logger.warning(f"\n{pretext()}\n{pretext()}\n")
exit(1)

confirmation_prompt()

def unsupported_arch() -> NoReturn:
"""Function to handle unsupported architecture.

Returns:
Returns exit code 1 if architecture is not AMD.
"""
# todo: include support for raspberry-pi
# todo: possible arch (arm11, cortex-a7, cortex-a53, cortex-53-aarch64, cortex-a72, cortex-a72-aarch64)
def untested_arch() -> None | NoReturn:
"""Function to handle unsupported architecture."""
logger.warning(f"\n{pretext()}\n{pretext()}\n")
logger.warning(f"Current Architecture: {env.architecture}")
logger.warning("Jarvis is currently supported only on AMD machines.")
logger.warning(center(f"Current Architecture: {env.architecture}"))
logger.warning(center("Jarvis has currently been tested only on AMD machines."))
logger.warning(
center("Please note that you might need to install additional dependencies.")
)
logger.warning(f"\n{pretext()}\n{pretext()}\n")
exit(1)
confirmation_prompt()


def unsupported_env() -> None:
def no_venv() -> None | NoReturn:
"""Function to handle installations that are NOT on virtual environments."""
logger.info(pretext())
logger.info(pretext())
logger.warning(f"\n{pretext()}\n{pretext()}\n")
logger.info(
center(
"""
Expand All @@ -203,8 +203,7 @@ def unsupported_env() -> None:
"""
)
)
logger.info(pretext())
logger.info(pretext())
logger.warning(f"\n{pretext()}\n{pretext()}\n")
confirmation_prompt()


Expand Down Expand Up @@ -332,13 +331,13 @@ def os_agnostic() -> None:
def init() -> None:
"""Runs pre-flight validations and upgrades ``setuptools`` and ``wheel`` packages."""
if env.osname not in ("darwin", "windows", "linux"):
unsupported_os()
untested_os()

if env.architecture != "amd64":
unsupported_arch()
untested_arch()

if sys.prefix == sys.base_prefix:
unsupported_env()
no_venv()

pyversion: str = (
f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"
Expand Down
Loading

0 comments on commit d833150

Please sign in to comment.