summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4085359781b4c2a92e56ec756685b46f6efb896b (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
# Maintainer: Nathan Robinson <nrobinson2000 at me dot com>

pkgname=dbt-snowflake
pkgver=1.5.1
pkgrel=1
pkgdesc="All of the code enabling dbt to work with Snowflake"
url="https://github.com/dbt-labs/dbt-snowflake"
provides=('dbt')
arch=('any')
license=('Apache')
source=("${url}/archive/refs/tags/v${pkgver}.tar.gz")
depends=('python')
sha256sums=('4bf925212138ea3b302627204dcc6b3263e54f03582e46b79fc89d787e900060')

package() {
    cd "${pkgname}-${pkgver}"

    _pkgshare="${pkgdir}/usr/share"
    _pkgbin="${pkgdir}/usr/bin"
    _venv="${_pkgshare}/${pkgname}"
    _app="dbt"

    # Create virtualenv
    mkdir -p "${_pkgshare}"
    python -m venv "${_venv}"

    # Install python wheel
    export XDG_CACHE_HOME="${srcdir}/cache"
    "${_venv}/bin/pip" install wheel

    # Install package in virtualenv
    "${_venv}/bin/pip" install .

    # Remove unnecessary stuff
    find "${_venv}/bin" -iname 'activate*' | xargs rm
    find "${_venv}/lib/" -name '*.dist-info' | xargs rm -r
    rm -r "${_venv}/share" "${_venv}/include"
    rm "${_venv}/lib64"

    # Fix shebangs
    sed -e "s|${pkgdir}||g" -i "${_venv}/bin/"*

    # Link dbt binary
    mkdir -p "${_pkgbin}"
    ln -s "/usr/share/${pkgname}/bin/${_app}" \
    "${_pkgbin}/${_app}"
}