1 | #!/usr/bin/env python |
---|
2 | import os, sys, platform, subprocess |
---|
3 | home = 'https://subversion.xor.aps.anl.gov/EXPGUI/' |
---|
4 | |
---|
5 | print sys.argv |
---|
6 | gsaspath = os.path.split(sys.argv[0])[0] |
---|
7 | gsaspath = os.path.abspath(os.path.expanduser(gsaspath)) |
---|
8 | |
---|
9 | print 'GSAS is being bootstrapped from repository to '+gsaspath |
---|
10 | |
---|
11 | print 'Determining system type...', |
---|
12 | if sys.platform.startswith('linux') and platform.processor().endswith('86'): |
---|
13 | repos = 'linux' |
---|
14 | elif sys.platform == "darwin" and platform.processor() == 'i386': |
---|
15 | repos = 'osxi86' |
---|
16 | else: |
---|
17 | raise Exception('Undefined system type') |
---|
18 | print 'OK' |
---|
19 | |
---|
20 | print 'Checking for subversion...', |
---|
21 | try: |
---|
22 | #p = subprocess.call(['svn','status'],stdout=subprocess.PIPE) |
---|
23 | p = subprocess.Popen(['svn','status'],stdout=subprocess.PIPE) |
---|
24 | except: |
---|
25 | raise Exception('Subversion (svn) not found') |
---|
26 | res = p.stdout.read() |
---|
27 | print 'OK' |
---|
28 | |
---|
29 | cmds = ( |
---|
30 | (['svn', 'switch', home+ 'trunk/', gsaspath+'/expgui'],'loading EXPGUI'), |
---|
31 | (['svn', 'switch', home+ 'gsas/' + repos+ '/exe/', gsaspath+'/exe'],'loading GSAS programs'), |
---|
32 | (['svn', 'switch', home+ 'gsas/' + repos+ '/pgplot/', gsaspath+'/pgplot'],'loading PGPLOT files'), |
---|
33 | ) |
---|
34 | |
---|
35 | for cmd,msg in cmds: |
---|
36 | print 70*'*' |
---|
37 | print msg + ' from ' + cmd[2] |
---|
38 | p = subprocess.call(cmd) |
---|
39 | |
---|
40 | if sys.platform.startswith('linux') and platform.processor().endswith('86'): |
---|
41 | open(os.path.expanduser('~/Desktop/EXPGUI.desktop'),'w').write(''' |
---|
42 | [Desktop Entry] |
---|
43 | Encoding=UTF-8 |
---|
44 | Version=1.0 |
---|
45 | Type=Application |
---|
46 | Terminal=false |
---|
47 | Exec=/tmp/gsas/expgui/expgui |
---|
48 | Name=EXPGUI |
---|
49 | Icon=/usr/share/pixmaps/gnome-gmenu.png |
---|
50 | ''') |
---|