File: show_version_info.sh

package info (click to toggle)
nipy 0.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,352 kB
  • sloc: python: 39,115; ansic: 30,931; makefile: 210; sh: 93
file content (64 lines) | stat: -rwxr-xr-x 1,432 bytes parent folder | download | duplicates (2)
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
#!/bin/bash
# Check returned versions for:
#
# * Install from git zip archive
# * Standard install
# * Local editable install.

PYTHON=${PYTHON:-python3}

VER_CHK_TMP=${PWD}/version_check_tmp
VER_FILE=${VER_CHK_TMP}/version_checks.txt
VENV_DIR=${VER_CHK_TMP}/venv
ZIP_FNAME=${VER_CHK_TMP}/project.zip
ZIP_DIR=${VER_CHK_TMP}/unpacked_zip

function mk_newdir {
    rm -rf $1
    mkdir $1
}

function extra_install {
    # Extra steps prior to pip install.
    # Will differ by package.
    pip install numpy
}

function install_show {
    local pkg_name=$1
    [ -z "$pkg_name" ] && (echo "Need package name" && exit 1)
    shift
    local inst_type=$1
    [ -z "$inst_type" ] && (echo "Need installation type" && exit 2)
    shift
    mk_newdir ${VENV_DIR}
    ${PYTHON} -m virtualenv ${VENV_DIR}
    ( . ${VENV_DIR}/bin/activate && \
        extra_install && \
        pip install $@ && \
        local pkg_ver=$(python -c "import $pkg_name; print(${pkg_name}.__version__)") && \
        echo "${pkg_name} - ${inst_type}: ${pkg_ver}" >> ${VER_FILE} && \
        deactivate )
}

mk_newdir ${VER_CHK_TMP}
cat << EOF > ${VER_FILE}
########
Versions
########

EOF

# Git zip archive
git archive --format zip -o $ZIP_FNAME HEAD
mk_newdir $ZIP_DIR
(cd $ZIP_DIR && unzip $ZIP_FNAME)
install_show nipy zip ${ZIP_DIR}

# Standard install
install_show nipy install .

# Local editable install
install_show nipy editable -e .

cat ${VER_FILE}