summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1c5dcea92ee47e137bef8021cfed1675574a161a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
pkgname=activitywatch
pkgver=0.13.2
pkgrel=1
url="https://github.com/ActivityWatch/${pkgname}"
pkgdesc="automatically tracks how you spend time on your devices"
license=("MPL2")
arch=('x86_64')
depends=(
    'python'  # obviously

    # aw-core
    'python-jsonschema' 'python-peewee' 'python-platformdirs' 'python-iso8601' 'python-strict-rfc3339' 'python-tomlkit' 'python-deprecation' 'python-timeslot'

    # aw-client
    'python-requests' 'python-persist-queue' 'python-click' 'python-tabulate'

    # aw-server
    'python-flask' 'python-flask-restx' 'python-flask-cors' 'python-importlib-metadata' 'python-werkzeug'

    # aw-qt
    'python-pyqt6'
    # 'python-importlib-metadata'

    # aw-watcher-{afk,window}
    'python-pynput' 'python-xlib'
)
makedepends=('python-build' 'python-installer' 'python-poetry-core' 'python-pip' 'npm')
source=("git+${url}.git#tag=v${pkgver}")
sha512sums=('SKIP')


prepare() {
    cd "$pkgbase"
    git submodule update --init --recursive
}

build() {
    echo $pkgbase
    cd "$pkgbase/aw-core"
    pwd
    python -m build --wheel --no-isolation

    cd "../aw-client"
    python -m build --wheel --no-isolation

    cd "../aw-server"
    python -m build --wheel --no-isolation

    cd aw-webui
    npm install
    npm run build
    cp media/logo/logo.png ./dist/
    cp media/logo/logo.svg ./dist/


    cd "../../aw-qt"
    python -m build --wheel --no-isolation


    cd "../aw-watcher-afk"
    python -m build --wheel --no-isolation


    cd "../aw-watcher-window"
    python -m build --wheel --no-isolation


    # cd "../aw-notify"
    # python -m build --wheel --no-isolation


    # cd "../aw-watcher-input"
    # python -m build --wheel --no-isolation

}

package() {
    python_lib_dir=$(python -c "import site; print(site.getsitepackages()[0])")
    echo $python_lib_dir

    cd "$pkgbase/aw-core"
    PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-deps ./dist/*.whl


    cd "../aw-client"
    PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-deps ./dist/*.whl


    cd "../aw-server"
    PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-deps ./dist/*.whl
    rm -rf "$pkgdir/$python_lib_dir/aw_server/static"
    mkdir "$pkgdir/$python_lib_dir/aw_server/static"
    cp -r aw-webui/dist/* "$pkgdir/$python_lib_dir/aw_server/static/"


    cd "../aw-qt"
    PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-deps ./dist/*.whl
    mkdir -p "$pkgdir/usr/share/applications/"
    mkdir -p "$pkgdir/usr/share/icons/"
    install -Dm644 resources/aw-qt.desktop "$pkgdir/usr/share/applications/"
    install -Dm644 media/logo/logo.png "$pkgdir/usr/share/icons/activitywatch.png"
    mkdir -p "$pkgdir/${python_lib_dir}/media/logo/"
    install -Dm644 media/logo/logo-128.png "$pkgdir/${python_lib_dir}/media/logo/logo.png"


    cd "../aw-watcher-afk"
    PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-deps ./dist/*.whl


    cd "../aw-watcher-window"
    PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-deps ./dist/*.whl


    # cd "../aw-notify"
    # PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-deps ./dist/*.whl

    # cd "../aw-watcher-input"
    # PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-deps ./dist/*.whl

}