Changeset 731406c in sasview for prview/build_prview.py
- Timestamp:
- Jun 20, 2010 6:25:45 PM (14 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 43db4a8
- Parents:
- ed90edb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
prview/build_prview.py
re4193d9 r731406c 6 6 # SVN must be installed: 7 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 8 # 9 # 10 # On Windows: 11 # - Make sure svn.exe in on the path. You might need to log out and log back in again after installing SVN. 12 # - Inno Setup must be installed 13 # - py2exe must be installed 14 # - mingw must be installed 15 # 16 # In Mac: 17 # - py2app must be installed 18 # - macholib must be installed to use py2app 19 # - modulegraph must be installed to use py2app 15 20 # 16 21 # Usage: … … 23 28 # -n: Print out the dependencies for the release notes 24 29 25 26 #TODO: touch site danse/__init__.py27 #TODO: touch site danse/common/__init__.py28 29 30 30 import os 31 31 import sys … … 36 36 import time 37 37 timestamp = int(time.time()) 38 CWD = os.getcwd() 38 39 INSTALL_FOLDER = "install_%s" % str(timestamp) 40 41 # On Windows, the python executable is not always on the path. 42 # Use its most frequent location as the default. 43 if sys.platform == 'win32': 44 PYTHON = "c:\python25\python" 45 LIB_FOLDER = "%s/%s" % (CWD, INSTALL_FOLDER) 46 else: 47 PYTHON = 'python' 39 48 40 49 logging.basicConfig(level=logging.INFO, … … 43 52 filemode='w') 44 53 45 CWD = os.getcwd()46 47 # On Windows, the python executable is not always on the path.48 # Use its most frequent location as the default.49 if sys.platform == 'win32':50 PYTHON = "c:\python25\python"51 BUILD_OPT = '-cmingw32'52 else:53 PYTHON = 'python'54 BUILD_OPT = ''55 56 54 SVN = "svn" 57 55 INNO = "\"c:\Program Files\Inno Setup 5\ISCC\"" 58 56 59 # Release version 0. 2.360 DATALOADER = "0.2. 4"61 GUICOMM = "0.1. 3"62 GUIFRAME = "0. 1.7"63 PRVIEW = "0.3. 0"64 PLOTTOOLS = "0.1. 6"65 UTIL = "0.1. 2"66 PR_INV = "0.2. 2"57 # Release version 0.3.3 58 DATALOADER = "0.2.7" 59 GUICOMM = "0.1.5" 60 GUIFRAME = "0.2.0" 61 PRVIEW = "0.3.3" 62 PLOTTOOLS = "0.1.9" 63 UTIL = "0.1.5" 64 PR_INV = "0.2.5" 67 65 68 66 # URLs for SVN repos … … 111 109 @param url: URL of the SVN repo 112 110 """ 113 if not os.path.isdir(install_dir): 114 os.mkdir(install_dir) 115 os.chdir(install_dir) 116 os.system("%s checkout -q %s" % (SVN, url)) 117 os.chdir(setup_dir) 118 os.system("%s setup.py -q build %s" % (PYTHON, BUILD_OPT)) 119 os.system("%s setup.py -q install" % PYTHON) 111 logging.info("Installing %s" % url) 112 try: 113 if not os.path.isdir(install_dir): 114 os.mkdir(install_dir) 115 os.chdir(install_dir) 116 os.system("%s checkout -q %s" % (SVN, url)) 117 os.chdir(setup_dir) 118 if sys.platform == 'win32': 119 os.system("%s setup.py -q build -cmingw32" % PYTHON) 120 os.system("%s setup.py -q install --root \"%s\"" % (PYTHON, LIB_FOLDER)) 121 else: 122 os.system("%s setup.py build" % PYTHON) 123 os.system("%s setup.py install --prefix ~/.local" % PYTHON) 124 except: 125 logging.error("Install failed for %s" % url) 126 logging.error(sys.exc_value) 127 raw_input("Press enter to continue\n") 128 sys.exit() 120 129 121 130 def checkout(release=False): … … 167 176 os.system("%s checkout -q svn://danse.us/sans/trunk/prview" % SVN) 168 177 169 def prepare(wipeout = False , install_folder=INSTALL_FOLDER):178 def prepare(wipeout = False): 170 179 """ 171 180 Prepare the build 181 182 @param wipeout: If True, the DANSE modules in the standard site-packages will be 183 removed to avoid conflicts. 172 184 """ 173 185 # Remove existing libraries 174 186 if wipeout == True: 175 print "Deleting old modules"187 logging.info("Deleting DANSES modules in site-packages") 176 188 from distutils.sysconfig import get_python_lib 177 189 libdir = get_python_lib() … … 187 199 188 200 # Create a fresh installation folder 189 if os.path.isdir( install_folder):190 shutil.rmtree( install_folder)191 192 os.mkdir( install_folder)201 if os.path.isdir(INSTALL_FOLDER): 202 shutil.rmtree(INSTALL_FOLDER) 203 204 os.mkdir(INSTALL_FOLDER) 193 205 194 206 # Check that the dependencies are properly installed … … 196 208 197 209 # Move to the installation folder 198 os.chdir( install_folder)210 os.chdir(INSTALL_FOLDER) 199 211 200 212 def warning(): … … 218 230 print "Build script for PrView %s" % PRVIEW 219 231 220 #TODO: add --prefix option221 222 232 if len(sys.argv)==1: 223 # By default, build release version in site-packages without cleanup 224 logging.info("Building release version") 225 prepare(install_folder="prview") 226 checkout(True) 227 # Create run script 228 f = open("run_prview.py", 'w') 229 buff = "import os, sys, site\n" 230 buff += "if __name__ == \"__main__\":\n" 231 buff += " sys.path.append(os.path.join(os.getcwd(),\"prview-%s\"))\n" % PRVIEW 232 buff += " site.addsitedir(os.path.join(os.getcwd(),\"prview-%s\"))\n" % PRVIEW 233 buff += " os.chdir(\"prview-%s\")\n" % PRVIEW 234 buff += " import sansview\n" 235 buff += " sansview.SansView()\n" 236 f.write(buff) 237 f.close() 238 239 elif len(sys.argv)>1: 233 # If there is no argument, build the installer 234 sys.argv.append("-i") 235 236 if len(sys.argv)>1: 240 237 # Help 241 238 if sys.argv[1]=="-h": … … 274 271 checkout(True) 275 272 if sys.platform=='win32': 276 logging.info("Building installer from release version")273 logging.info("Building Windows installer from release version") 277 274 os.chdir("prview-%s" % (PRVIEW)) 278 os.system("%s setup_exe.py -q py2exe" % PYTHON)275 os.system("%s setup_exe.py py2exe --extrapath \"%s\python25\lib\site-packages\"" % (PYTHON, LIB_FOLDER)) 279 276 os.system("%s/Q installer.iss" % INNO) 280 shutil.copy2(os.path.join("Output","setupPrView.exe"), 281 os.path.join(CWD, "setupPrView_%s.exe" % str(timestamp))) 277 shutil.copy2(os.path.join("Output","setupSansView.exe"), 278 os.path.join(CWD, "setupSansView_%s.exe" % str(timestamp))) 279 elif sys.platform=='darwin': 280 logging.info("Building Mac application from release version") 281 os.chdir("prview-%s" % (PRVIEW)) 282 os.system("%s setup_mac.py py2app" % PYTHON) 282 283 283 284 raw_input("Press enter to continue\n")
Note: See TracChangeset
for help on using the changeset viewer.