source: sasview/sansview/build_sansview.py @ f31701c

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 f31701c was 553d047, checked in by Mathieu Doucet <doucetm@…>, 16 years ago

sansview: added more common default

  • Property mode set to 100644
File size: 6.8 KB
RevLine 
[40f9745]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#
[249bae9]14# mingw must be installed
15#
[40f9745]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.
[249bae9]23#   -n: Print out the dependencies for the release notes
[40f9745]24
25import os
26import shutil
27
[553d047]28PYTHON = "c:\python25\python"
[40f9745]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"
[249bae9]40PARK       = "1.2.x"
[fa523d3]41PARK_INTEG = "0.1.0"
[249bae9]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
[fa523d3]50PARK_INTEG_URL = "svn://danse.us/sans/releases/park_integration-%s" % PARK_INTEG
[249bae9]51#TODO: need to use the release branch of PARK once it is created
52PARK_URL = "svn://danse.us/park/branches/park-1.2"
[40f9745]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)
[249bae9]100    os.system("%s setup.py build -cmingw32" % PYTHON)
[40f9745]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:
[249bae9]111        install_pkg(".", "sansmodels-%s/src" % SANSMODELS, SANSMODELS_URL)
[40f9745]112    else:
113        install_pkg(".", "sansmodels/src", "svn://danse.us/sans/trunk/sansmodels")
114   
115    os.chdir(wd)
116    if release:
[249bae9]117        install_pkg(".", "DataLoader-%s" % DATALOADER, DATALOADER_URL)
[40f9745]118    else:
119        install_pkg(".", "DataLoader", "svn://danse.us/sans/trunk/DataLoader")
120   
121    os.chdir(wd)
122    if release:
[249bae9]123        install_pkg(".", "guicomm-%s" % GUICOMM, GUICOMM_URL)
[40f9745]124    else:
125        install_pkg(".", "guicomm", "svn://danse.us/sans/trunk/guicomm")
126   
127    os.chdir(wd)
128    if release:
[249bae9]129        install_pkg(".", "guiframe-%s" % GUIFRAME, GUIFRAME_URL)
[40f9745]130    else:
131        install_pkg(".", "guiframe", "svn://danse.us/sans/trunk/guiframe")
132   
133    os.chdir(wd)
134    if release:
[249bae9]135        install_pkg("plottools-%s" % PLOTTOOLS, "trunk", PLOTTOOLS_URL)
[40f9745]136    else:
137        install_pkg("plottools", "trunk", "svn://danse.us/common/plottools/trunk")
138   
139    os.chdir(wd)
140    if release:
[249bae9]141        install_pkg(".", "util-%s" % UTIL, UTIL_URL)
[40f9745]142    else:
143        install_pkg(".", "util", "svn://danse.us/common/util")
144   
[fa523d3]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   
[40f9745]151    #TODO: need a release version of PARK
152    os.chdir(wd)
153    if release:
[249bae9]154        install_pkg(".", "park-1.2", PARK_URL)
[40f9745]155    else:
156        install_pkg(".", "park-1.2", "svn://danse.us/park/branches/park-1.2")
157   
158    os.chdir(wd)
159    if release:
[249bae9]160        os.system("%s checkout %s" % (SVN, SANSVIEW_URL))
[40f9745]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    if len(sys.argv)>1:
182        if sys.argv[1]=="-h":
183            print "Usage:"
184            print "    python build_sansview [command]\n"
185            print "[command] can be any of the following:"
186            print "    -h: lists the command line options"
187            print "    -r: Builds a SansView using the released modules"
188            print "    -t: Builds SansView from the trunk"
189            print "    -i: Builds an installer from the release version"       
[249bae9]190            print "    -n: Print out the dependencies for the release notes"
[fa523d3]191        elif sys.argv[1]=="-n":
[249bae9]192            print SANSMODELS_URL
193            print DATALOADER_URL
194            print GUICOMM_URL
195            print GUIFRAME_URL
196            print PLOTTOOLS_URL
197            print UTIL_URL
[fa523d3]198            print SANSVIEW_URL
199            print PARK_INTEG
[249bae9]200            print PARK_URL
[40f9745]201        else:
202            # Prepare installation folder
203            prepare()
204           
205            # Check the command line argument
206            if sys.argv[1]=="-t":
207                print "Building trunk version"
208                checkout()
209            elif sys.argv[1]=="-r":
210                print "Building release version"
211                checkout(True)
212            elif sys.argv[1]=="-i":
213                print "Building release version"
214                checkout(True)
215                print "Building installer from release version"
216                os.chdir("sansview-%s" % (SANSVIEW))
217                os.system("%s setup_exe.py py2exe" % PYTHON)
218                os.system("%s installer.iss" % INNO)
219   
Note: See TracBrowser for help on using the repository browser.