source: sasview/sansview/build_sansview.py @ f6b65b8

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since f6b65b8 was 6e2fe95, checked in by Mathieu Doucet <doucetm@…>, 15 years ago

sansview: build script now defaults to full installer build

  • Property mode set to 100644
File size: 7.1 KB
Line 
1#
2# Script to get source from SVN and build SansView
3#
4# Read the release notes to make ensure that the required software is installed.
5#
6# SVN must be installed:
7# http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91
8# Make sure svn.exe in on the path. You might need to log out and log back in again after installing SVN.
9#
10# Inno Setup must be installed
11#
12# py2exe must be installed
13#
14# mingw must be installed
15#
16# Usage:
17# python build_sansview [command]
18# [command] can be any of the following:
19#   -h: lists the command line options
20#   -r: Builds a SansView using the released modules.
21#   -t: Builds SansView from the trunk.
22#   -i: Builds an installer from the release version.
23#   -n: Print out the dependencies for the release notes
24
25import os
26import shutil
27
28PYTHON = "c:\python25\python"
29SVN    = "svn"
30INNO   = "\"c:\Program Files\Inno Setup 5\ISCC\""
31
32# Release version 0.1.0
33SANSMODELS = "0.4.2"
34DATALOADER = "0.2.1"
35GUICOMM    = "0.1.1"
36GUIFRAME   = "0.1.4"
37SANSVIEW   = "0.1.0"
38PLOTTOOLS  = "0.1.3"
39UTIL       = "0.1"
40PARK       = "1.2.x"
41PARK_INTEG = "0.1.0"
42
43SANSMODELS_URL = "svn://danse.us/sans/releases/sansmodels-%s" % SANSMODELS
44DATALOADER_URL = "svn://danse.us/sans/releases/DataLoader-%s" % DATALOADER
45GUICOMM_URL = "svn://danse.us/sans/releases/guicomm-%s" % GUICOMM
46GUIFRAME_URL = "svn://danse.us/sans/releases/guiframe-%s" % GUIFRAME
47PLOTTOOLS_URL = "svn://danse.us/common/releases/plottools-%s/trunk" % PLOTTOOLS
48UTIL_URL = "svn://danse.us/common/releases/util-%s" % UTIL
49SANSVIEW_URL = "svn://danse.us/sans/releases/sansview-%s" % SANSVIEW
50PARK_INTEG_URL = "svn://danse.us/sans/releases/park_integration-%s" % PARK_INTEG
51#TODO: need to use the release branch of PARK once it is created
52PARK_URL = "svn://danse.us/park/branches/park-1.2"
53
54# Installation folder
55import time
56timestamp = int(time.time())
57INSTALL_FOLDER = "install_%s" % str(timestamp)
58
59
60def check_system():
61    """
62        Checks that the system has the necessary modules.
63    """
64    try:
65        import wx
66    except:
67        print "wxpython missing"
68   
69    try:
70        import matplotlib
71    except:
72        print "matplotlib missing"
73       
74    try:
75        import numpy
76    except:
77        print "numpy missing"
78       
79    try:
80        import scipy
81    except:
82        print "scipy missing"
83       
84    if os.system("gcc -dumpversion")==1:
85         print "missing mingw"
86
87def install_pkg(install_dir, setup_dir, url):
88    """
89        Check a package out and install it
90       
91        @param install_dir: directory to put the code in
92        @param setup_dir: relative location of the setup.py script
93        @param url: URL of the SVN repo
94    """
95    if not os.path.isdir(install_dir):
96        os.mkdir(install_dir)
97    os.chdir(install_dir)   
98    os.system("%s checkout -q %s" % (SVN, url))       
99    os.chdir(setup_dir)
100    os.system("%s setup.py build -cmingw32" % PYTHON)
101    os.system("%s setup.py install" % PYTHON)
102   
103def checkout(release=False):
104    """
105        Check the SansView code out
106    """
107    wd = os.getcwd()
108   
109    os.chdir(wd)
110    if release:
111        install_pkg(".", "sansmodels-%s/src" % SANSMODELS, SANSMODELS_URL)
112    else:
113        install_pkg(".", "sansmodels/src", "svn://danse.us/sans/trunk/sansmodels")
114   
115    os.chdir(wd)
116    if release:
117        install_pkg(".", "DataLoader-%s" % DATALOADER, DATALOADER_URL)
118    else:
119        install_pkg(".", "DataLoader", "svn://danse.us/sans/trunk/DataLoader")
120   
121    os.chdir(wd)
122    if release:
123        install_pkg(".", "guicomm-%s" % GUICOMM, GUICOMM_URL)
124    else:
125        install_pkg(".", "guicomm", "svn://danse.us/sans/trunk/guicomm")
126   
127    os.chdir(wd)
128    if release:
129        install_pkg(".", "guiframe-%s" % GUIFRAME, GUIFRAME_URL)
130    else:
131        install_pkg(".", "guiframe", "svn://danse.us/sans/trunk/guiframe")
132   
133    os.chdir(wd)
134    if release:
135        install_pkg("plottools-%s" % PLOTTOOLS, "trunk", PLOTTOOLS_URL)
136    else:
137        install_pkg("plottools", "trunk", "svn://danse.us/common/plottools/trunk")
138   
139    os.chdir(wd)
140    if release:
141        install_pkg(".", "util-%s" % UTIL, UTIL_URL)
142    else:
143        install_pkg(".", "util", "svn://danse.us/common/util")
144   
145    os.chdir(wd)
146    if release:
147        install_pkg(".", "park_integration-%s" % PARK_INTEG, PARK_INTEG_URL)
148    else:
149        install_pkg(".", "park_integration", "svn://danse.us/sans/trunk/park_integration")
150   
151    #TODO: need a release version of PARK
152    os.chdir(wd)
153    if release:
154        install_pkg(".", "park-1.2", PARK_URL)
155    else:
156        install_pkg(".", "park-1.2", "svn://danse.us/park/branches/park-1.2")
157   
158    os.chdir(wd)
159    if release:
160        os.system("%s checkout %s" % (SVN, SANSVIEW_URL))
161    else:
162        os.system("%s checkout svn://danse.us/sans/trunk/sansview" % SVN)
163   
164def prepare():
165    # Create a fresh installation folder
166   
167    if os.path.isdir(INSTALL_FOLDER):
168        shutil.rmtree(INSTALL_FOLDER)
169
170    os.mkdir(INSTALL_FOLDER)
171   
172    # Check that the dependencies are properly installed
173    check_system()   
174   
175    # Move to the installation folder
176    os.chdir(INSTALL_FOLDER)   
177
178if __name__ == "__main__": 
179    import sys
180   
181    print "Build script for SansView %s" % SANSVIEW
182   
183    if len(sys.argv)==1:
184        # If there is no argument, build the installer
185        sys.argv.append("-i")
186       
187    if len(sys.argv)>1:
188        # Help
189        if sys.argv[1]=="-h":
190            print "Usage:"
191            print "    python build_sansview [command]\n"
192            print "[command] can be any of the following:"
193            print "    -h: lists the command line options"
194            print "    -r: Builds a SansView using the released modules"
195            print "    -t: Builds SansView from the trunk"
196            print "    -i: Builds an installer from the release version"       
197            print "    -n: Print out the dependencies for the release notes"
198        elif sys.argv[1]=="-n":
199            # Print out release URLs
200            print SANSMODELS_URL
201            print DATALOADER_URL
202            print GUICOMM_URL
203            print GUIFRAME_URL
204            print PLOTTOOLS_URL
205            print UTIL_URL
206            print SANSVIEW_URL
207            print PARK_INTEG
208            print PARK_URL
209        else:
210            # Prepare installation folder
211            prepare()
212           
213            # Check the command line argument
214            if sys.argv[1]=="-t":
215                print "Building trunk version"
216                checkout()
217            elif sys.argv[1]=="-r":
218                print "Building release version"
219                checkout(True)
220            elif sys.argv[1]=="-i":
221                print "Building release version"
222                checkout(True)
223                print "Building installer from release version"
224                os.chdir("sansview-%s" % (SANSVIEW))
225                os.system("%s setup_exe.py py2exe" % PYTHON)
226                os.system("%s installer.iss" % INNO)
227   
Note: See TracBrowser for help on using the repository browser.