Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/CeibalEncuesta/gtk2/scripts/prepare_xo_installer
blob: 5e1bc1aa823cb54c395a061a187d06b07fd438ec (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
#!/bin/sh

XO_INSTALLER_PATH='../CeibalEncuesta.activity'
CEIBAL_ENCUESTA_PATH='../CeibalEncuesta'
INSTALLERS_PATH='../installers'

cp -r $CEIBAL_ENCUESTA_PATH/* $XO_INSTALLER_PATH/
rm -rf `find ../ -type f -name '*.pyc'`
rm -rf `find ../ -type f -name '*.pyo'`

echo "YOU NEED REPLACE IN "$XO_INSTALLER_PATH"/CeibalEncuesta.py the follow:"
echo ""

function change_main_program {
    while [ `grep -R "$3" ${XO_INSTALLER_PATH}/CeibalEncuesta.py | wc -l` -ne "1" ]
    do
        echo $1"- "$2
        echo "    "$3
        echo ""

        echo "Do that and Enter to continue [ENTER]: "
        read key
    done
}

LINE='from sugar.activity import activity'
MSG='ADD:'
change_main_program "1" "$MSG" "$LINE"

LINE='class CeibalEncuesta(activity.Activity):'
MSG='CeibalEncuesta class need inherit from: activity.Activity like that:'
change_main_program "2" "$MSG" "$LINE"

LINE='def __init__(self, handle):'
MSG='Add handle argument into __init__ method like that:'
change_main_program "3" "$MSG" "$LINE"

LINE='activity.Activity.__init__(self, handle, False)'
MSG='replace gtk.Window.__init__(self) to:'
change_main_program "4" "$MSG" "$LINE"

if [ `grep -R "self.add(" ${XO_INSTALLER_PATH}/CeibalEncuesta.py | wc -l` -ne "0" ]
    then
        echo "5 - replace each ocurence of self.add to self.set_canvas Example: self.add(box) -> self.add to self.set_canvas(box)"
        echo ""
        echo "Do that and Enter to continue [ENTER]: "
        read key
fi

while [ `grep -R "self.add(" ${XO_INSTALLER_PATH}/CeibalEncuesta.py | wc -l` -ne "0" ]
do
    echo "occurrences remain of self.add() method. You need replace for: self.set_canvas() method"
    echo ""

    echo "Do that and Enter to continue [ENTER]: "
    read key
done

echo "#!/usr/bin/env python
from sugar.activity import bundlebuilder
bundlebuilder.start()" > $XO_INSTALLER_PATH/setup.py
echo "setup.py was added to ".$XO_INSTALLER_PATH." path"
echo ""

echo "You need edit activity_version = VERSION into ".$XO_INSTALLER_PATH."/activity/activity.info"
echo "VERSION is version for you new deploy. Do that and Enter to continue [ENTER]:"
read key

chmod 755 $XO_INSTALLER_PATH
chmod a+x $XO_INSTALLER_PATH/CeibalEncuesta.py
chmod a+x $XO_INSTALLER_PATH/setup.py

rm -f $INSTALLERS_PATH/CeibalEncuesta.activity-gtk2.xo


zip -D -r $INSTALLERS_PATH/CeibalEncuesta.activity-gtk2.xo $XO_INSTALLER_PATH

rm -rf `find $XO_INSTALLER_PATH |grep -v /activity |grep -v -w "CeibalEncuesta.activity$"`

echo ""
echo "DONE: CeibalEncuesta.activity-gtk2.xo was placed into installers directory."