Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download
Views: 39595
1
#!/bin/bash
2
3
# script "smc-project-sagews-dev"
4
# use when ready to start new branch of development for SMC sagews
5
# requirements:
6
# git upstream remote repo is sagemathinc.smc, used read-only
7
# git origin remote repo is developer's fork of smc in developer's github
8
# local smc git repo at ~/smc
9
# be ready with new branch name, for example "isssue456utf"
10
#
11
# usage:
12
# new-issue [new-branch-name]
13
# script will ask for new-branch-name if not provided on command line
14
15
trap "echo '**script error exit**';exit" ERR
16
17
echo "NOTE: restart your SMC dev project before running this script"
18
19
if [[ $# -ge 1 ]];then
20
BNAME=$1
21
else
22
echo -n "name of new SMC branch (issueXXXdescword): "
23
read BNAME
24
fi
25
echo -n "ok to start smc dev on new branch $BNAME? (y|n) "
26
read ans
27
case $ans in
28
y|Y)
29
;;
30
*)
31
echo canceled
32
;;
33
esac
34
35
cd ~/smc
36
# echo "checking that 'upstream' remote is main SMC github repo"
37
git config remote.upstream.url | grep -q sagemathinc/smc.git || {
38
echo "git remote upstream must point to sagemathinc/smc.git"
39
exit 1
40
}
41
42
# echo "checking that 'origin' remote is non-upstream SMC github repo"
43
git remote show origin|grep "Push.*smc.git"|grep -vq sagemathinc || {
44
echo "git remote origin must point to non-sagemathinc smc github repo"
45
exit 1
46
}
47
48
if [[ $EUID -eq 0 ]]; then
49
echo "This script must NOT be run as root"
50
exit 1
51
fi
52
53
54
echo "killing old sage worksheet processes"
55
pkill -f sage_server_command_line || test $? -eq 1
56
rm -f ~/.smc/sage_server/sage_server.pid
57
58
echo "updating git"
59
git checkout master
60
git pull upstream master
61
git checkout -b $BNAME
62
63
echo "updating smc_sagews and tests"
64
cd ~/smc/src/smc_sagews
65
pip install --user --upgrade ./
66
67
echo "running tests"
68
cd ~/smc/src/smc_sagews/smc_sagews/tests
69
70
# baseline run of all tests before we start making changes
71
python -m pytest
72
73
echo "setup for branch $BNAME done"
74
75