-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add demonstration programs for testing (#3)
README.md: Updated for this commit. developers_notes.txt: New file used for tracking developer information This is intended to be later put into either Wiki or Readme files. drats_*/hello_world_*.py: Sample demonstration programs fedora/requirements.txt: mobaxterm/requirements.txt: windows/requirements.txt: PyPi modules needed for running D-Rats. install_*.sh: Installation scripts for Linux like platforms with Bash. pylintrc: Remove suppressions that that should not be needed for drats2.
- Loading branch information
Showing
16 changed files
with
867 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/python | ||
|
||
import logging | ||
import os | ||
from sys import exit | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
default_gtk = '4.0' | ||
if 'MSYSTEM' in os.environ: | ||
default_gtk = '3.0' | ||
try: | ||
import gi # type: ignore | ||
try: | ||
gi.require_version('Gtk', default_gtk) | ||
except ValueError: | ||
logger.info(f'GTK {default_gtk} is not available!') | ||
try: | ||
gi.require_version('Gtk', '3.0') | ||
except ValueError: | ||
logger.error('GTK 3 does not appear to be installed!') | ||
exit(1) | ||
from gi.repository import Gtk # type: ignore | ||
except ModuleNotFoundError: | ||
logger.error('GTK does not appear to be installed!') | ||
exit(1) | ||
|
||
def on_activate(app): | ||
win = Gtk.ApplicationWindow(application=app) | ||
win.present() | ||
|
||
def main(): | ||
app = Gtk.Application() | ||
app.connect('activate', on_activate) | ||
|
||
app.run(None) | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/python | ||
|
||
import logging | ||
# import os | ||
from sys import exit | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
try: | ||
from kivy.app import App | ||
from kivy.uix.widget import Widget | ||
except ModuleNotFoundError: | ||
logger.error('Kivy does not appear to be installed!') | ||
exit(1) | ||
|
||
|
||
class HelloWorld(Widget): | ||
pass | ||
|
||
|
||
class HelloApp(App): | ||
def build(self): | ||
return HelloWorld() | ||
|
||
|
||
def main(): | ||
HelloApp().run() | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/python | ||
|
||
import tkinter as tk | ||
|
||
def main(): | ||
window = tk.Tk() | ||
window.mainloop() | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/python | ||
|
||
import wx | ||
|
||
def main(): | ||
app = wx.App() | ||
frame = wx.Frame(parent=None, title='Hello World') | ||
frame.Show() | ||
app.MainLoop() | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pip | ||
kivy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
set -uex | ||
|
||
DEBIAN_FRONTEND=noninteractive | ||
export DEBIAN_FRONTEND | ||
|
||
sudo -S -E apt-get --assume-yes update | ||
sudo -S -E apt-get --assume-yes install \ | ||
aspell aspell-de aspell-en aspell-es aspell-it aspell-nl \ | ||
ca-certificates \ | ||
gedit \ | ||
libcairo2-dev \ | ||
libxml2-utils \ | ||
libgirepository1.0-dev \ | ||
python3 \ | ||
python3-feedparser \ | ||
python3-flask \ | ||
python3-geopy \ | ||
python3-gevent \ | ||
python3-gi \ | ||
python3-gi-cairo \ | ||
python3-greenlet \ | ||
python3-kivy \ | ||
python3-lxml \ | ||
python3-pil \ | ||
python3-pyaudio \ | ||
python3-pycountry \ | ||
python3-pydub \ | ||
python3-serial \ | ||
python3-tk \ | ||
wxpython-tools | ||
|
||
if [[ "${1:-}" == dev* ]]; then | ||
sudo -S -E apt-get --assume-yes install \ | ||
bandit \ | ||
codespell \ | ||
gcc \ | ||
make \ | ||
pkg-config \ | ||
pylint \ | ||
python3-dev \ | ||
python3-ipykernel \ | ||
python3-pip \ | ||
python3-simplejson \ | ||
python3-sphinx \ | ||
python3_venv \ | ||
shellcheck \ | ||
yamllint | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/bash | ||
|
||
set -uex | ||
|
||
my_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" | ||
|
||
sudo dnf -y install \ | ||
aspell aspell-de aspell-en aspell-es aspell-it aspell-nl \ | ||
ca-certificates \ | ||
gedit \ | ||
libxml2 \ | ||
python3 \ | ||
python3-cairo \ | ||
python3-feedparser \ | ||
python3-flask \ | ||
python3-geopy \ | ||
python3-gevent \ | ||
python3-gobject \ | ||
python3-greenlet \ | ||
python3-libxml2 \ | ||
python3-pillow \ | ||
python3-pyaudio \ | ||
python3-pycountry \ | ||
python3-pyserial \ | ||
python3-wxpython4 | ||
|
||
pypi_dir=~/drats_support/local/lib/pypi | ||
mkdir -p "$pypi_dir" | ||
|
||
if [ -e "$pypi_dir/bin/pip3" ]; then | ||
echo 'Pip already updated' | ||
else | ||
# Pip always complains if a newer version is available until | ||
# you upgrade to it. | ||
echo "upgrading pip, this will warn that pip needs upgrading" | ||
pip3 install --upgrade --target="$pypi_dir" pip | ||
ls "$pypi_dir/bin" | ||
fi | ||
# Need to set PYTHONPATH to use the PyPi packages | ||
PYTHONPATH="$pypi_dir" | ||
export PYTHONPATH | ||
ls "$pypi_dir/bin" | ||
# If we do not include pip here, for some reason pip removes the | ||
# binary for it. Why??? | ||
"$pypi_dir/bin"/pip3 install --upgrade --target="$pypi_dir" \ | ||
-r "${my_dir}/fedora/requirements.txt" | ||
|
||
if [[ "${1:-}" == dev* ]]; then | ||
sudo dnf -y install \ | ||
bandit \ | ||
codespell \ | ||
gcc \ | ||
make \ | ||
pkgconf-pkg-config \ | ||
pylint \ | ||
python3-devel \ | ||
python3-ipykernel \ | ||
python3-pip \ | ||
python3-simplejson \ | ||
python3-sphinx \ | ||
python3-tkinter \ | ||
python3-virtualenv \ | ||
shellcheck \ | ||
yamllint | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/bash | ||
|
||
set -uex | ||
|
||
my_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" | ||
|
||
: "${NAME:=unknown}" | ||
: "${ID:=unknown}" | ||
: "${ID_LIKE:=unknown}" | ||
if [ -e /etc/os-release ]; then | ||
# shellcheck disable=SC1091 | ||
source /etc/os-release | ||
else | ||
# Cygwin / MobaXterm does not have /etc/os-release file | ||
if [ -e /cygdrive ]; then | ||
# Found for Cygwin / MobaXterm | ||
if [ -e /bin/MobaBox.exe ]; then | ||
# Found MobaXterm | ||
ID="mobaxterm" | ||
ID_LIKE="cygwin" | ||
else | ||
ID="cygwin" | ||
fi | ||
fi | ||
fi | ||
# Debian ID="debian" no ID_LIKE present has wxpython-tools, python3-kivy | ||
# Ubuntu ID="ubuntu" ID_LIKE=debian has wxpython-tools, python3-kivy | ||
# | ||
# Fedora ID="fedora" no ID_LIKE python3-wxpython4 no kivy package | ||
# epel for el-8 and el-9 also have the python3-wxpython4 | ||
# No current cygwin users, no scripted package install known. | ||
# msys2 ID="msys2" has mingw-w64-x86_64-wxPython | ||
# mobaxterm has python3.9 and python39-wx package, no gtk4, no kivy | ||
case "$ID" in | ||
mobaxterm) | ||
"${my_dir}/install_mobaxterm.sh" | ||
;; | ||
msys2) | ||
"${my_dir}/install_msys2.sh" | ||
;; | ||
fedora) | ||
# Rocky/Alma is probably similar to this | ||
"${my_dir}/install_fedora.sh" | ||
;; | ||
debian|ubuntu) | ||
"${my_dir}/install_debian.sh" | ||
;; | ||
*) | ||
echo "$ID is not yet supported by this script." | ||
exit 1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
|
||
set -uex | ||
|
||
my_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" | ||
|
||
# MobaXterm has some of these packages built in. | ||
# curl git wget | ||
|
||
# MobaXterm uses aliases which are needed in a setup script | ||
apt_get='/bin/MobaBox.exe apt-get' | ||
mkdir='/usr/bin/busybox mkdir' | ||
|
||
# This is needed to prevent pop ups that pause the install | ||
DEBIAN_FRONTEND=noninteractive | ||
export DEBIAN_FRONTEND | ||
# Update to current and add packages | ||
# apt-get --assume-yes update | ||
$apt_get -y upgrade | ||
$apt_get -y install \ | ||
aspell aspell-de aspell-en aspell-es aspell-it \ | ||
ffmpeg \ | ||
gedit gettext gettext-devel git gcc-core \ | ||
libgtk3_0 libjpeg-devel libportaudio-devel \ | ||
python3 python3-pip python3-tkinter \ | ||
zlib-devel | ||
|
||
python_version_raw="$(python --version)" | ||
python_version="${python_version_raw#* }" | ||
python_major_minimum="${python_version%.*}" | ||
python_major="${python_major_minimum%.*}" | ||
python_minor="${python_major_minimum#*.}" | ||
pyver="python${python_major}${python_minor}" | ||
|
||
$apt_get -y install \ | ||
"${pyver}-devel" "${pyver}-gi" "${pyver}-lxml" \ | ||
"${pyver}-sphinx" "${pyver}-wx" \ | ||
|
||
pypi_dir=/usr/local/lib/pypi | ||
$mkdir -p "$pypi_dir" | ||
|
||
if [ -e "$pypi_dir/bin/pip3" ]; then | ||
echo 'Pip already updated' | ||
else | ||
# Pip always complains if a newer version is available until | ||
# you upgrade to it. | ||
echo "upgrading pip, this will warn that pip needs upgrading" | ||
pip3 install --upgrade --target="$pypi_dir" pip | ||
ls "$pypi_dir/bin" | ||
fi | ||
# Need to set PYTHONPATH to use the PyPi packages | ||
PYTHONPATH="$pypi_dir" | ||
export PYTHONPATH | ||
ls "$pypi_dir/bin" | ||
# If we do not include pip here, for some reason pip removes the | ||
# binary for it. Why??? | ||
"$pypi_dir/bin"/pip3 install --upgrade --target="$pypi_dir" \ | ||
-r "${my_dir}/mobaxterm/requirements.txt" | ||
# | ||
# kivy does not apparently install on cygwin/MobaXterm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/bash | ||
|
||
set -uex | ||
|
||
mingw='mingw-w64-x86_64' | ||
|
||
pacman -Syu --noconfirm \ | ||
"${mingw}-ca-certificates" \ | ||
"${mingw}-python" \ | ||
"${mingw}-gtk4" \ | ||
"${mingw}-gettext" \ | ||
"${mingw}-python3-gobject" \ | ||
"${mingw}-aspell" "${mingw}-aspell-en" \ | ||
"${mingw}-python-pywin32" \ | ||
"${mingw}-python-lxml" \ | ||
"${mingw}-python-pyserial" \ | ||
"${mingw}-python-pillow" \ | ||
"${mingw}-python-pycountry" \ | ||
"${mingw}-wxPython" | ||
|
||
if [[ "${1:-}" == dev* ]]; then | ||
# packaging | ||
# no aspell-it dictionary at this time. | ||
pacman -Syu --noconfirm \ | ||
"${mingw}-gcc" \ | ||
"${mingw}-make" \ | ||
"${mingw}-python-codespell" \ | ||
"${mingw}-python-pylint" \ | ||
"${mingw}-python-setuptools" \ | ||
"${mingw}-python-virtualenv" | ||
|
||
# This should not be needed, but is for now. | ||
ln -sf /mingw64/bin/mingw32-make.exe /mingw64/bin/make.exe | ||
fi |
Oops, something went wrong.