source: orange/install-scripts/mac/build-source.sh @ 10623:2c440c34c248

Revision 10623:2c440c34c248, 1.3 KB checked in by Ales Erjavec <ales.erjavec@…>, 2 years ago (diff)

Use setup.py to publish the sources and rotate latest versions.

  • Property exe set to *
Line 
1#!/bin/bash -e
2#
3# Build an Orange source package from a hg repo
4#
5# $1 hg repo
6# $2 local repository inside work dir
7# $3 hg revision
8# $4 work dir
9# $5 distribution name
10# $6 source and egg distribution dir ($4 by default)
11# $7 force
12#
13# Example ./build-source.sh http://bitbucket.org/biolab/orange orange tip /private/tmp/repos Orange
14
15HG_REPO=$1
16REPO_DIRNAME=$2
17HG_REV=$3
18WORK_DIR=$4
19DIST_NAME=$5
20DIST_DIR=${6:-$WORK_DIR}
21FORCE=$7
22
23# dist name with '-' replaced
24UDIST_NAME=`echo $DIST_NAME | sed s/-/_/g`
25
26LOCAL_REPO=$WORK_DIR/$REPO_DIRNAME
27
28LATEST_REVISION=`hg id $HG_REPO`
29
30if [ -e $WORK_DIR/$UDIST_NAME.egg-info/PKG-INFO ]; then
31    CURRENT_REVISION=`grep "^Version: " $WORK_DIR/$UDIST_NAME.egg-info/PKG-INFO | cut -d "-" -f 3`
32else
33    CURRENT_REVISION=""
34fi
35
36if [[ $CURRENT_REVISION != $LATEST_REVISION  || $FORCE ]]; then
37    BUILD=1
38else
39    BUILD=
40fi
41echo $BUILD
42
43if [ $BUILD ]; then
44    if [ ! -e $LOCAL_REPO ]; then
45        hg clone $HG_REPO $LOCAL_REPO
46    fi
47
48    if hg incoming -R $LOCAL_REPO; then
49        hg pull -R $LOCAL_REPO
50    fi
51
52    hg update -r $HG_REV -R $LOCAL_REPO
53
54    cd $LOCAL_REPO
55
56    # Remove old sources
57    rm -rf dist/
58
59    # Build the source distribution
60    BUILD_TAG=`hg parent --template=".dev-r{rev}-{node|short}"`
61
62    python setup.py egg_info --tag-build=$BUILD_TAG --egg-base=$DIST_DIR sdist --dist-dir=$DIST_DIR
63    python setup.py rotate --match=.tar.gz --dist-dir=$DIST_DIR --keep=20
64fi
Note: See TracBrowser for help on using the repository browser.