Skip to content

Commit

Permalink
Add complete dependency list on Ubuntu (#55)
Browse files Browse the repository at this point in the history
In order to figure this out (and make sure I was correct) I used a Docker container. By design it's awkward to support dbus & bluetooth from within a container, so totally understandable if you'd prefer to not include the Dockerfile in the repo.

I managed to get the app to run and print out "Bluetooth is disabled" which exercises a decent bit of the code. If this is helpful, it could be the start of some light CI/GitHub workflows to run some testing for PRs.

Co-authored-by: Alex R <[email protected]>
  • Loading branch information
Yasumoto and Alex R authored Aug 3, 2021
1 parent ef4b2ee commit f394094
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 11 deletions.
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM ubuntu:21.04

ENV DEBIAN_FRONTEND="noninteractive" TZ=" America/Los_Angeles"

# xvfb is used to mock out the display for testing and is not required for real builds
RUN apt update && apt install -y \
libgtk-3-dev python3-pip meson python3-dbus gtk-update-icon-cache desktop-file-utils gettext appstream-util libglib2.0-dev && \
apt install -y xvfb && \
rm -rf /var/lib/apt/lists/* && apt clean

RUN pip3 install gatt pyxdg requests black

COPY . /siglo

WORKDIR /siglo

RUN pwd && ls && mkdir -p ./build && \
meson --reconfigure ./build/ && \
cd ./build && ninja install

CMD ["/bin/bash"]

# Once the container is running, you should have all the dependencies you need
# Start system dbus, then kickoff the app. For more details, you can see GTK's setup:
# https://gitlab.gnome.org/GNOME/gtk/-/blob/fb052c8d2546706b49e5adb87bc88ad600f31752/.gitlab-ci.yml#L122
#
# /etc/init.d/dbus start && dbus-run-session xvfb-run -a -s "-screen 0 1024x768x24" siglo
42 changes: 35 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
# siglo

GTK app to sync InfiniTime watch with PinePhone

'siglo' means century in Spanish

## Dependencies

### Arch Linux
```

```sh
sudo pacman -S --needed meson python-pip base-devel bluez bluez-utils dbus-python
pip3 install gatt pyxdg
```

### Fedora

```
sudo dnf install meson glib2-devel
pip3 install gatt
```

### Ubuntu
```
sudo apt install meson python3-dbus gettext appstream-util libglib2.0-dev
pip3 install gatt

```sh
sudo apt install libgtk-3-dev python3-pip meson python3-dbus gtk-update-icon-cache desktop-file-utils gettext appstream-util libglib2.0-dev
pip3 install gatt pyxdg requests black
```

## Build/Install

```
git clone https://github.com/alexr4535/siglo.git
cd siglo
Expand All @@ -30,11 +38,30 @@ cd build
sudo ninja install
```

### Mocked Testing with Docker

While you won't get bluetooth connectivity, you can get some high-level vetting in a container, which
will open the way forward to better CI testing on GitHub.

The [`Dockerfile`](Dockerfile) contains all required dependencies, in addition to
[`xvfb`](https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml) which allows us to make sure
the app can execute.

```sh
sudo docker build . --tag siglo; and sudo docker run --name siglo --volume (pwd):/siglo --rm -it siglo:latest
```

Once the container is running, you can launch the app:

```sh
/etc/init.d/dbus start && dbus-run-session xvfb-run -a -s "-screen 0 1024x768x24" siglo
```

## Building and installing Flatpak app

### Building and installing on target architecture

```
```sh
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --user flathub org.gnome.Sdk//3.38 org.gnome.Platform//3.38

Expand All @@ -47,7 +74,7 @@ flatpak install --user ./siglo.flatpak

Example cross-compiling for PinePhone on an `x86_64` Fedora machine:

```
```sh
sudo dnf install qemu-system-arm qemu-user-static
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --user flathub org.gnome.Sdk/aarch64/3.38 org.gnome.Platform/aarch64/3.38
Expand All @@ -58,11 +85,12 @@ flatpak build-bundle --arch=aarch64 ./repo/ siglo.flatpak org.gnome.siglo

Transfer the `siglo.flatpak` file on the PinePhone and install it with the following command:

```
```sh
sudo flatpak install ./siglo.flatpak
```

##

If this project helped you, you can buy me a cup of coffee :)
<br/><br/>
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/ironrobin)
Expand Down
4 changes: 0 additions & 4 deletions src/bluetooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,5 @@ class BluetoothDisabled(Exception):
pass


class BluetoothDisabled(Exception):
pass


class NoAdapterFound(Exception):
pass

0 comments on commit f394094

Please sign in to comment.