JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for CCPNMR Archives


CCPNMR Archives

CCPNMR Archives


CCPNMR@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

CCPNMR Home

CCPNMR Home

CCPNMR  June 2008

CCPNMR June 2008

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: trouble installing ccpnmr analysis package in Ubuntu 8.04 (fwd)

From:

Wayne Boucher <[log in to unmask]>

Reply-To:

CcpNmr software mailing list <[log in to unmask]>

Date:

Mon, 2 Jun 2008 17:10:41 +0100

Content-Type:

MULTIPART/MIXED

Parts/Attachments:

Parts/Attachments

TEXT/PLAIN (22 lines) , installCode.py (1 lines)

Hello,

I've attached a modified installCode.py which I managed to get to work
(not as smoothly as one would want) with Ubuntu 8.04 on my Mac (which only
has a lib not a lib32 or a lib64, so it seems has dispensed with the
32-bit libraries, so I had to answer N to the 64-bit question even
though it is true).

So the script said it couldn't find tcl.h in /usr/include (correct) and
then asks where the Tcl dir is, and if you put in /usr then it finds the
on in /usr/include/tcl8.4 (and another one which is ignorable).  Then it
asked for the Tcl/Tk version (so couldn't figure it out) so answer 8.4
Then it asks fo rthe Tk dir, and if you put /usr again it will again
search and find /usr/lib/tcl8.4 (note, not tk8.4!) and that is correct so
choose it.  On my machine there were also several Pythons installed so it
got the Python version wrong, so I had to give it the correct one.  I
didn't try the OpenGL option so from there it worked smoothly.  Yes, these
are all dumb questions which the script should be able to figure out
better.  Next time...

Wayne


import os import string import sys api_distribution = 'api' format_distribution = 'format' analysis_distribution = 'analysis' distributions = (api_distribution, format_distribution, analysis_distribution) top_dir = os.getcwd() distribution = 'analysis' program_name = None program_names = { \ api_distribution: 'Api', format_distribution: 'Format Converter', analysis_distribution: 'Analysis', } tcl_tk_platform = 'unix' # needed for Tcl/Tk bin_rel_dir = 'bin' ccpnmr_rel_dir = 'ccpnmr1.0' tcltk_version = '8.4' tcltk_release = '8.4.14' tcl_rel_dir = 'tcl%s' % tcltk_version tcl_tar_dir = 'tcl%s' % tcltk_release tcl_tar_file = tcl_tar_dir + '.tar' tcl_tar_file_gz = tcl_tar_file + '.gz' tk_rel_dir = 'tk%s' % tcltk_version tk_tar_dir = 'tk%s' % tcltk_release tk_tar_file = tk_tar_dir + '.tar' tk_tar_file_gz = tk_tar_file + '.gz' #python_version = '2.2' #python_release = '2.2.3' min_python_version = '2.2' python_version = '2.4' python_release = '2.4.2' python_rel_dir = 'python%s' % python_version python_tar_dir = 'Python-%s' % python_release python_tar_file = python_tar_dir + '.tar' python_tar_file_gz = python_tar_dir + '.tgz' mesa_version = '6.0' mesa_release = '6.0' mesa_rel_dir = 'mesa%s' % mesa_version mesa_prefix = 'Mesa' mesa_tar_dir = '%s-%s' % (mesa_prefix, mesa_release) mesa_tar_file1 = '%sLib-%s.tar' % (mesa_prefix, mesa_release) mesa_tar_file1_gz = mesa_tar_file1 + '.gz' mesa_tar_file2 = '%sDemos-%s.tar' % (mesa_prefix, mesa_release) mesa_tar_file2_gz = mesa_tar_file2 + '.gz' possible_platforms = ('linux', 'irix', 'sunos', 'darwin') include_dir = 'include' lib_dirs = ('lib', 'lib32') # too many choices for irix and sunos to make a guess comp_arch_guess = { \ 'linux': ('linux-x86', 'Linux on a PC'), 'darwin': ('darwin', 'Mac OSX'), } mesa_comp_arch_msg = """ aix for AIX systems with xlc aix-sl for AIX systems, make shared libs aix-gcc for AIX sytems with gcc beos-r4 for BeOS R4 cygnus for Win95/NT using Cygnus-Win32 cygnus-linux for Win95/NT using Cygnus-Win32 under Linux darwin for Darwin - Mac OS X freebsd for FreeBSD systems with GCC freebsd-386 for FreeBSD systems with GCC, w/ Intel assembly gcc-sl for a generic system with GCC for shared libs hpux9 for HP systems with HPUX 9.x hpux9-sl for HP systems with HPUX 9.x, make shared libs hpux9-gcc for HP systems with HPUX 9.x using GCC hpux9-gcc-sl for HP systems with HPUX 9.x, GCC, make shared libs hpux10 for HP systems with HPUX 10.x and 11.x hpux10-sl for HP systems with HPUX 10.x and 11.x, shared libs hpux10-gcc for HP systems with HPUX 10.x w/ GCC hpux10-gcc-sl for HP systems with HPUX 10.x w/ GCC, shared libs irix6-o32 for SGI systems with IRIX 6.x, make o32-bit libs irix6-o32-dso for SGI systems with IRIX 6.x, make o32-bit DSOs irix6-n32 for SGI systems with IRIX 6.x, make n32-bit libs irix6-n32-dso for SGI systems with IRIX 6.x, make n32-bit DSOs irix6-gcc-n32-sl for SGI systems with IRIX 6.x, GCC, make n32 DSOs irix6-64 for SGI systems with IRIX 6.x, make 64-bit libs irix6-64-dso for SGI systems with IRIX 6.x, make 64-bit DSOs linux for Linux linux-x86 for Linux with x86 optimizations linux-ggi for Linux with libggi driver linux-x86-ggi for Linux with libggi driver and x86 optimizations linux-glide for Linux with 3Dfx Glide driver linux-x86-glide for Linux with 3Dfx Glide driver and x86 opts linux-alpha for Linux with Alpha optimizations linux-alpha-static for Linux with Alpha opts, make static libs linux-ppc for Linux with PowerPC opts linux-ppc-static for Linux with PowerPC opts, make static libs linux-sparc for Linux with Sparc optimzations linux-sparc5 for Linux with Sparc5 optimizations linux-sparc-ultra for Linux with UltraSparc optimizations linux-osmesa16 for 16-bit/channel OSMesa linux-osmesa16-static for 16-bit/channel OSMesa, make static libs linux-osmesa32 for 32-bit/channel OSMesa linux-solo for Linux standalone with DRI drivers linux-icc for Linux with the Intel C/C++ compiler lynxos for LynxOS systems with GCC mklinux for Linux on Power Macintosh netbsd for NetBSD 1.0 systems with GCC openbsd for OpenBSD systems openstep for OpenStep/MacOSX Server systems osf1 for DEC Alpha systems with OSF/1 qnx for QNX V4 systems with Watcom compiler solaris-x86 for PCs with Solaris solaris-x86-gcc for PCs with Solaris using GCC sunos4 for Suns with SunOS 4.x sunos4-sl for Suns with SunOS 4.x, make shared libs sunos4-gcc for Suns with SunOS 4.x and GCC sunos4-gcc-sl for Suns with SunOS 4.x, GCC, make shared libs sunos5 for Suns with SunOS 5.x sunos5-smp for Suns with SunOS 5.x, SMP optimization sunos5-gcc for Suns with SunOS 5.x and GCC sunos5-gcc-debug for Suns with SunOS 5.x and GCC ultrix-gcc for DEC systems with Ultrix and GCC unixware for PCs running UnixWare unixware-shared for PCs running UnixWare, shared libs """ mesa_comp_arch = [] s = string.split(mesa_comp_arch_msg, '\n')[1:-1] for x in s: mesa_comp_arch.append(string.split(x)[0]) format_program = 'formatConverter' data_shifter_program = 'dataShifter' analysis_program = 'analysis' updateCode_program = 'updateCheck' updateAuto_program = 'updateAll' pipe2azara_program = 'pipe2azara' python_program = 'python' fp_log = None def runCmds(cmds): cmd = string.join(cmds, ';') #print 'COMMAND =', cmd os.system(cmd) def writeLog(message): if (fp_log): fp_log.write('%s\n' % message) def doPrint(message): print message writeLog(message) def getInput(prompt, doLower = 1, default = None): s = '' while (not s): s = raw_input(prompt + ' ') s = string.strip(s) if (not s and default is not None): s = default writeLog('%s %s' % (prompt, s)) if (doLower): s = string.lower(s) return s def getPlatform(): platform = sys.platform flag = 0 for p in possible_platforms: if (string.find(platform, p) >= 0): platform = p doPrint('Assuming your platform is %s' % platform) flag = 1 break if (not flag): s = getInput('Cannot figure out your platform, is it one of %s (y or n)?' % (possible_platforms,)) if (s == 'y'): while (platform not in possible_platforms): platform = getInput('Which platform (%s)?:' % (possible_platforms,)) else: #doPrint('Unknown platform, there will probably be problems') platform = None return platform def getShell(): shell = os.environ.get('SHELL') if not shell: return shell n = string.rfind(shell, '/') if n >= 0: shell = shell[n+1:] return shell def unpackTcl(): os.chdir(tcl_rel_dir) cmds = [] if (os.path.exists(tcl_tar_dir)): cmds.append('rm -rf %s' % tcl_tar_dir) for dir in ('bin', 'include', 'lib', 'man'): if (os.path.exists(dir)): cmds.append('rm -rf %s' % dir) if (os.path.exists(tcl_tar_file_gz)): cmds.append('gunzip %s' % tcl_tar_file_gz) # else assume it has already been gunzipped cmds.append('tar xvf %s' % tcl_tar_file) cmds.append('gzip %s' % tcl_tar_file) runCmds(cmds) #os.chdir('..') os.chdir(top_dir) def compileTcl(): os.chdir(tcl_rel_dir + '/' + tcl_tar_dir + '/' + tcl_tk_platform) cmds = [] cmds.append('./configure --prefix=%s/%s' % (top_dir, tcl_rel_dir)) cmds.append('make') cmds.append('make install') runCmds(cmds) #os.chdir('../../..') os.chdir(top_dir) def unpackTk(): os.chdir(tk_rel_dir) cmds = [] if (os.path.exists(tk_tar_dir)): cmds.append('rm -rf %s' % tk_tar_dir) for dir in ('bin', 'include', 'lib', 'man'): if (os.path.exists(dir)): cmds.append('rm -rf %s' % dir) if (os.path.exists(tk_tar_file_gz)): cmds.append('gunzip %s' % tk_tar_file_gz) # else assume it has already been gunzipped cmds.append('tar xvf %s' % tk_tar_file) cmds.append('gzip %s' % tk_tar_file) runCmds(cmds) #os.chdir('..') os.chdir(top_dir) def compileTk(tcl_abs_dir): os.chdir(tk_rel_dir + '/' + tk_tar_dir + '/' + tcl_tk_platform) cmds = [] cmds.append('./configure --prefix=%s/%s --with-tcl=%s/lib' % (top_dir, tk_rel_dir, tcl_abs_dir)) cmds.append('make') cmds.append('make install') runCmds(cmds) #os.chdir('../../..') os.chdir(top_dir) def unpackPython(): os.chdir(python_rel_dir) cmds = [] if (os.path.exists(python_tar_dir)): cmds.append('rm -rf %s' % python_tar_dir) for dir in ('bin', 'include', 'lib', 'man'): if (os.path.exists(dir)): cmds.append('rm -rf %s' % dir) if (os.path.exists(python_tar_file_gz)): cmds.append('gunzip %s' % python_tar_file_gz) # else assume it has already been gunzipped cmds.append('tar xvf %s' % python_tar_file) cmds.append('gzip %s' % python_tar_file) cmds.append('mv %s.gz %s' % (python_tar_file, python_tar_file_gz)) runCmds(cmds) #os.chdir('..') os.chdir(top_dir) def compilePython(x11_abs_dir, tcl_abs_dir, tk_abs_dir, x11_lib_path, tcl_lib_path, tk_lib_path, tcl_incl_path, tk_incl_path): if tcl_lib_path and tk_lib_path: # add Tcl/Tk to LD_LIBRARY_PATH add_path = '%s:%s' % (tcl_lib_path, tk_lib_path) path = os.environ.get('LD_LIBRARY_PATH') if path: path = '%s:%s' % (path, add_path) else: path = add_path os.environ['LD_LIBRARY_PATH'] = path os.chdir(python_rel_dir + '/' + python_tar_dir) if (x11_abs_dir and tcl_abs_dir and tk_abs_dir): # need to create Modules/Setup so that our Tcl/Tk found fp = open('Modules/Setup.dist') lines = fp.readlines() fp.close() fp = open('Modules/Setup', 'w') s = '# The _tkinter module.' n = len(s) for line in lines: fp.write(line) if (line[:n] == s): fp.write(''' # lines below added in by CcpNmr installation script _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \\ -L%s -L%s -L%s \\ -I%s -I%s -I%s/include \\ -l%s -l%s -lX11 # lines above added in by CcpNmr installation script ''' % (tcl_lib_path, tk_lib_path, x11_lib_path, tcl_incl_path, tk_incl_path, x11_abs_dir, tcl_rel_dir, tk_rel_dir)) fp.close() # now compile and install code cmds = [] cmds.append('./configure --prefix=%s/%s' % (top_dir, python_rel_dir)) cmds.append('make') cmds.append('make install') runCmds(cmds) #os.chdir('../..') os.chdir(top_dir) def unpackMesa(): os.chdir(mesa_rel_dir) cmds = [] if (os.path.exists(mesa_tar_dir)): cmds.append('rm -rf %s' % mesa_tar_dir) for dir in ('etc', 'include', 'lib'): if (os.path.exists(dir)): cmds.append('rm -rf %s' % dir) if (os.path.exists(mesa_tar_file1_gz)): cmds.append('gunzip %s' % mesa_tar_file1_gz) # else assume it has already been gunzipped cmds.append('tar xvf %s' % mesa_tar_file1) if (os.path.exists(mesa_tar_file2_gz)): cmds.append('gunzip %s' % mesa_tar_file2_gz) # else assume it has already been gunzipped cmds.append('tar xvf %s' % mesa_tar_file2) cmds.append('gzip %s' % mesa_tar_file1) cmds.append('gzip %s' % mesa_tar_file2) runCmds(cmds) #os.chdir('..') os.chdir(top_dir) def getCompArch(platform): if (platform): (comp_arch, comp_msg) = comp_arch_guess.get(platform, '') else: comp_arch = '' if (comp_arch): s = getInput('Is your computer %s (%s) (y or n)?' % (comp_arch, comp_msg)) else: s = 'n' if (s[0] == 'n'): doPrint('Possible Mesa architecture compilations:') doPrint(mesa_comp_arch_msg) comp_arch = getInput('Which is the most appropriate architecture for your computer?', doLower=0) while (comp_arch not in mesa_comp_arch): doPrint('That architecture not on list, try again') comp_arch = getInput('Which is the most appropriate architecture for your computer?', doLower=0) return comp_arch def compileMesa(comp_arch): os.chdir(mesa_rel_dir + '/' + mesa_tar_dir) # Mesa compilation changed between v4.0 and v6.0 cmds = [] #cmds.append('./configure --prefix=%s/%s' % (top_dir, mesa_rel_dir)) #cmds.append('make') #cmds.append('make install') cmds.append('make %s' % comp_arch) runCmds(cmds) os.chdir('..') for dir in ('include', 'lib'): os.symlink('%s/%s' % (mesa_tar_dir, dir), dir) #os.chdir('..') os.chdir(top_dir) def createEnvironmentFile(platform, x11_abs_dir, x11_lib_dir, tcl_abs_dir, tcl_lib_dir, tcl_incl_dir, tk_abs_dir, tk_lib_dir, tk_incl_dir, python_abs_dir, python_lib_dir, mesa_abs_dir, mesa_lib_dir, doOpenGL, needGlutInit, useFrameworkGlut, usePic): mesa_dirs = string.split(mesa_abs_dir, ':') if mesa_dirs: mesa_abs_dir = mesa_dirs[0] env_file = '%s/c/environment.txt' % ccpnmr_rel_dir if (not platform): doPrint('Unknown platform, %s installation procedure will probably fail and you will need to edit %s by hand, continuing anyway using linux options' % (program_name, env_file)) platform = 'linux' if (platform == 'windows'): mallocFlag = '' else: # other platforms seem not to need this now mallocFlag = '-DDO_NOT_HAVE_MALLOC' if (usePic): picFlag = '-fPIC' else: picFlag = '' if (platform == 'sunos'): xorFlag = '-DXOR_IS_EQUIV' else: xorFlag = '' if (doOpenGL): ignoreGL = '' glCom = '' else: ignoreGL = '-DIGNORE_GL' glCom = '#' if (platform == 'linux'): glFlag = '-DUSE_GL_FALSE' else: glFlag = '-DUSE_GL_TRUE' if needGlutInit: glutNeedInit = '-DNEED_GLUT_INIT' else: glutNeedInit = '' if (platform == 'sunos'): sharedFlag = '-G' elif (platform == 'darwin'): sharedFlag = '-L/sw/lib -bundle -bundle_loader %s/bin/python%s' % (python_abs_dir, python_version) else: sharedFlag = '-shared' if useFrameworkGlut: glLibs = '-framework GLUT -lGLU -lGL' extraGlIncludeFlag = '-I/System/Library/Frameworks/GLUT.framework/Headers' extraGlLibFlag = '-framework GLUT' glutNotInGl = '-DGLUT_IN_OWN_DIR' else: glLibs = '-lglut -lGLU -lGL' if len(mesa_dirs) > 1: dir = mesa_dirs[1] extraGlIncludeFlag = '-I%s/include' % dir extraGlLibFlag = '-L%s/%s' % (dir, mesa_lib_dir) else: extraGlIncludeFlag = '' extraGlLibFlag = '' glutNotInGl = '' if (os.path.exists(env_file)): env_backup = '%s/c/environment.bak' % ccpnmr_rel_dir if (os.path.exists(env_backup)): os.remove(env_backup) doPrint('Backing up %s to %s' % (env_file, env_backup)) os.rename(env_file, env_backup) fp = open(env_file, 'w') fp.write(''' # should work if suitably edited for Linux, Irix, Solaris, OSX # the C compiler CC = cc # compiler flags MALLOC_FLAG = %s # use below for everything with malloc.h #MALLOC_FLAG = # use below for everything without malloc.h (e.g. OSX) #MALLOC_FLAG = -DDO_NOT_HAVE_MALLOC FPIC_FLAG = %s # use below for everything with -fPIC option (e.g. gcc) #FPIC_FLAG = -fPIC # use below for everything without -fPIC option #FPIC_FLAG = XOR_FLAG = %s # use below for everything where Tk xor behaves normally #XOR_FLAG = # use below for everything (e.g. Solaris) where xor is equiv #XOR_FLAG = -DXOR_IS_EQUIV CFLAGS = -O $(MALLOC_FLAG) $(FPIC_FLAG) $(XOR_FLAG) # specify whether or not you want to compile GL IGNORE_GL_FLAG = %s # use below if you want to compile GL #IGNORE_GL_FLAG = # use below if you want to ignore GL #IGNORE_GL_FLAG = -DIGNORE_GL # special GL flag, should have either USE_GL_TRUE or USE_GL_FALSE # (-D means this gets defined by the compiler so can be checked in source code) # (this relates to glXCreateContext() call in ccpnmr/global/gl_handler.c) # if have problems with USE_GL_TRUE then try GL_FALSE, or vice versa GL_FLAG = %s # use below for Linux? #GL_FLAG = -DUSE_GL_FALSE # use below for everything else? #GL_FLAG = -DUSE_GL_TRUE GLUT_NEED_INIT = %s # use below if your glut does not need to be explicitly initialised #GLUT_NEED_INIT = # use below if your glut needs to be explicitly initialised #GLUT_NEED_INIT = -DNEED_GLUT_INIT GLUT_NOT_IN_GL = %s # whether glut.h is GL/glut.h (normal case) or just glut.h (OSX) # use below if glut.h is in GL directory #GLUT_NOT_IN_GL = # use below if glut.h is not in GL directory (e.g. OSX) #GLUT_NOT_IN_GL = -DGLUT_IN_OWN_DIR # special glut flag GLUT_FLAG = $(GLUT_NEED_INIT) $(GLUT_NOT_IN_GL) # shared library flags SHARED_FLAGS = %s # use below for Linux or Irix #SHARED_FLAGS = -shared # use below for OSX (assuming python executable is /sw/bin/python) #SHARED_FLAGS = -L/sw/lib -bundle -bundle_loader /sw/bin/python # use below for Solaris #SHARED_FLAGS = -G # math MATH_LIB = -lm # X11 X11_DIR = %s # use below for everything but Irix #X11_DIR = /usr/X11R6 # use below for Irix #X11_DIR = /usr X11_LIB = -lX11 -lXext X11_INCLUDE_FLAGS = -I$(X11_DIR)/include X11_LIB_FLAGS = -L$(X11_DIR)/%s # use below for 32 bit except on Irix #X11_LIB_FLAGS = -L$(X11_DIR)/lib # use below for 32 bit on Irix #X11_LIB_FLAGS = -L$(X11_DIR)/lib32 # use below for 64 bit (not OSX?) #X11_LIB_FLAGS = -L$(X11_DIR)/lib64 # Tcl TCL_DIR = %s TCL_LIB = -ltcl%s TCL_INCLUDE_FLAGS = -I$(TCL_DIR)/%s TCL_LIB_FLAGS = -L$(TCL_DIR)/%s # Tk TK_DIR = %s TK_LIB = -ltk%s TK_INCLUDE_FLAGS = -I$(TK_DIR)/%s TK_LIB_FLAGS = -L$(TK_DIR)/%s # Python PYTHON_DIR = %s PYTHON_INCLUDE_FLAGS = -I$(PYTHON_DIR)/include/python%s # GL %sGL_DIR = %s %sGL_LIB = %s # use below if compiling GL, except on OSX #GL_LIB = -lglut -lGLU -lGL # use below if compiling GL on OSX #GL_LIB = -framework GLUT -lGLU -lGL # use below if not compiling GL (or comment out GL_LIB line) #GL_LIB = # set GL_INCLUDE_FLAGS and GL_LIB_FLAGS if compiling GL %sGL_INCLUDE_FLAGS = -I$(GL_DIR)/include %s %sGL_LIB_FLAGS = -L$(GL_DIR)/%s %s # use below if compiling GL, except on OSX #GL_INCLUDE_FLAGS = -I$(GL_DIR)/include # use below if compiling GL on OSX #GL_INCLUDE_FLAGS = -I$(GL_DIR)/include -I/System/Library/Frameworks/GLUT.framework/Headers # use below if not compiling GL #GL_INCLUDE_FLAGS = # use below if compiling GL for everything 32 bit but Irix and OSX #GL_LIB_FLAGS = -L$(GL_DIR)/lib # use below for OSX #GL_LIB_FLAGS = -L$(GL_DIR)/lib -framework GLUT # use below for 32 bit Irix #GL_LIB_FLAGS = -L$(GL_DIR)/lib32 # use below for 64 bit (not on OSX?) #GL_LIB_FLAGS = -L$(GL_DIR)/lib64 # use below if not compiling GL (or comment out GL_LIB_FLAGS line) #GL_LIB_FLAGS = ''' % (mallocFlag, picFlag, xorFlag, ignoreGL, glFlag, glutNeedInit, glutNotInGl, sharedFlag, x11_abs_dir, x11_lib_dir, tcl_abs_dir, tcltk_version, tcl_incl_dir, tcl_lib_dir, tk_abs_dir, tcltk_version, tk_incl_dir, tk_lib_dir, python_abs_dir, python_version, glCom, mesa_abs_dir, glCom, glLibs, glCom, extraGlIncludeFlag, glCom, mesa_lib_dir, extraGlLibFlag)) fp.close() def compileAnalysis(python_abs_dir): # need to make sure picking up correct Python before compiling Analysis path = os.environ.get('PATH') if (path): path = '%s:%s' % (python_abs_dir, path) else: path = python_abs_dir os.environ['PATH'] = path """ old way of doing it, before had top-level makefile os.chdir('%s/c/ccpnmr' % ccpnmr_rel_dir) for dir in ('global', 'clouds', 'analysis'): os.chdir('%s' % dir) cmds = ['make'] runCmds(cmds) os.chdir('..') #os.chdir('../../..') os.chdir(top_dir) """ os.chdir('%s/c' % ccpnmr_rel_dir) cmds = ['make'] runCmds(cmds) #os.chdir('../..') os.chdir(top_dir) def createSymbolicLinks(): script = './linkSharedObjs' cmds = ['chmod u+x %s' % script, script] os.chdir('%s/python' % ccpnmr_rel_dir) for dir in ('memops/c', 'ccp/c', 'ccpnmr/c'): os.chdir(dir) runCmds(cmds) os.chdir('../..') #os.chdir('../..') os.chdir(top_dir) def writeEnvString(fp, key, value, useExport): if useExport: fp.write('export %s=%s\n' % (key, value)) else: fp.write('setenv %s %s\n' % (key, value)) def writeEnvVars(fp, tcl_lib_path, tk_lib_path, mesa_lib_path, useExport): if getShell() == 'tcsh': # on some Linux /bin/tcsh seems not to work in this context shell = '/bin/csh' if (not os.path.exists(shell)): shell = os.environ.get('SHELL') else: shell = os.environ.get('SHELL') if shell: fp.write('#!%s\n\n' % shell) writeEnvString(fp, 'CCPNMR_TOP_DIR', top_dir, useExport) writeEnvString(fp, 'PYTHONPATH', '.:$CCPNMR_TOP_DIR/%s/python' % ccpnmr_rel_dir, useExport) writeEnvString(fp, 'LD_LIBRARY_PATH', '%s:%s%s' % (tcl_lib_path, tk_lib_path, mesa_lib_path), useExport) writeEnvString(fp, 'TCL_LIBRARY', '%s/tcl%s' % (tcl_lib_path, tcltk_version), useExport) writeEnvString(fp, 'TK_LIBRARY', '%s/tk%s' % (tk_lib_path, tcltk_version), useExport) def createBin(python_bin_dir, tcl_lib_path, tk_lib_path, mesa_lib_path, useExport): if (os.path.exists(bin_rel_dir)): cmds = [ 'rm -rf %s' % bin_rel_dir ] runCmds(cmds) os.mkdir(bin_rel_dir) os.chdir(bin_rel_dir) python_exe = '%s/bin/python' % python_bin_dir if (not os.path.exists(python_exe)): python_exe2 = python_exe + python_version if (os.path.exists(python_exe2)): python_exe = python_exe2 else: doPrint('Could not find "%s" nor "%s" so assuming python executable is former for now' % (python_exe, python_exe2)) doPrint('You will probably need to edit scripts in %s/%s' % (top_dir, bin_rel_dir)) if (distribution != api_distribution): # make format converter program fp = open(format_program, 'w') writeEnvVars(fp, tcl_lib_path, tk_lib_path, '', useExport) fp.write('%s -O $CCPNMR_TOP_DIR/%s/python/ccpnmr/format/gui/FormatConverter.py $1 $2\n' % (python_exe, ccpnmr_rel_dir)) fp.close() os.chmod(format_program, 0755) # make data shifter program fp = open(data_shifter_program, 'w') writeEnvVars(fp, tcl_lib_path, tk_lib_path, '', useExport) fp.write('%s -O $CCPNMR_TOP_DIR/%s/python/ccpnmr/format/gui/DataShifter.py\n' % (python_exe, ccpnmr_rel_dir)) fp.close() os.chmod(data_shifter_program, 0755) if (distribution == analysis_distribution): # make analysis program fp = open(analysis_program, 'w') writeEnvVars(fp, tcl_lib_path, tk_lib_path, mesa_lib_path, useExport) fp.write('%s -i -O $CCPNMR_TOP_DIR/%s/python/ccpnmr/analysis/AnalysisGui.py $1 $2 $3 $4 $5\n' % (python_exe, ccpnmr_rel_dir)) fp.close() os.chmod(analysis_program, 0755) # make updateCode program fp = open(updateCode_program, 'w') writeEnvVars(fp, tcl_lib_path, tk_lib_path, '', useExport) fp.write('%s -O $CCPNMR_TOP_DIR/%s/python/ccpnmr/update/UpdatePopup.py\n' % (python_exe, ccpnmr_rel_dir)) fp.close() os.chmod(updateCode_program, 0755) # make updateAuto program fp = open(updateAuto_program, 'w') writeEnvVars(fp, tcl_lib_path, tk_lib_path, '', useExport) fp.write('%s -O $CCPNMR_TOP_DIR/%s/python/ccpnmr/update/UpdateAuto.py\n' % (python_exe, ccpnmr_rel_dir)) fp.close() os.chmod(updateAuto_program, 0755) # make pipe2azara program fp = open(pipe2azara_program, 'w') writeEnvVars(fp, tcl_lib_path, tk_lib_path, '', useExport) fp.write('%s -O $CCPNMR_TOP_DIR/%s/python/ccpnmr/analysis/NmrPipeData.py $1 $2 $3\n' % (python_exe, ccpnmr_rel_dir)) fp.close() os.chmod(pipe2azara_program, 0755) # make python symbolic link # not sure os.symlink works on Windows #os.symlink('%s/bin/%s' % (python_bin_dir, python_program), python_program) #os.chdir('..') os.chdir(top_dir) def runProgram(program, tcl_lib_path, tk_lib_path, mesa_lib_path): os.environ['CCPNMR_TOP_DIR'] = top_dir os.environ['PATH'] = '%s/bin:%s' % (top_dir, os.environ['PATH']) os.environ['PYTHONPATH'] = '.:%s/%s/python' % (top_dir, ccpnmr_rel_dir) os.environ['LD_LIBRARY_PATH'] = '%s:%s%s' % (tcl_lib_path, tk_lib_path, mesa_lib_path) os.environ['TCL_LIBRARY'] = '%s/tcl%s' % (tcl_lib_path, tcltk_version) os.environ['TK_LIBRARY'] = '%s/tk%s' % (tk_lib_path, tcltk_version) cmds = [ program ] runCmds(cmds) def doUpgrade(): # a bit of a hack this # link old way (nuclei) with new way (chemElement) old_dir = '%s/data/ccp/nuclei' % ccpnmr_rel_dir old_file = 'nuclei.xml' new_file = '../chemElement/chemElements.xml' if (not os.path.exists(old_dir)): os.mkdir(old_dir) os.chdir(old_dir) if (os.path.exists(old_file)): os.remove(old_file) try: os.symlink(new_file, old_file) except: doPrint('could not symbolically link %s to %s' % (new_file, old_file)) #os.chdir('../../../..') os.chdir(top_dir) # link old way (nonpolymer) with new way (other) base_dir = '%s/data/ccp/chemComp' % ccpnmr_rel_dir old_sub_dir = 'nonpolymer' new_sub_dir = 'other' old_dir = os.path.join(base_dir, old_sub_dir) new_dir = os.path.join(base_dir, new_sub_dir) os.chdir(base_dir) if (os.path.exists(old_sub_dir) and os.path.isdir(old_sub_dir)): os.chdir(old_sub_dir) try: files = os.listdir('.') for file in files: os.remove(file) except: doPrint('Could not remove contents of %s (probably not a problem)' % old_dir) os.chdir('..') try: os.rmdir(old_sub_dir) except: doPrint('Could not remove directory %s (probably not a problem)' % old_dir) if (not os.path.exists(old_sub_dir)): try: os.symlink(new_sub_dir, old_sub_dir) except: doPrint('Could not symbolically link %s to %s (might be a problem)' % (new_dir, old_dir)) #os.chdir('../../../..') os.chdir(top_dir) def dirContainsFiles(dir, files, allowMultiDirs): if allowMultiDirs: dirs = string.split(dir, ':') else: dirs = [dir] for file in files: foundMatch = 0 for dir in dirs: if (file[-1] == '*'): file = file[:-1] (d, t) = os.path.split(file) d = os.path.join(dir, d) try: fs = os.listdir(d) except: continue for f in fs: if (f[:len(t)] == t): doPrint('[ found match %s ]' % os.path.join(d, f)) foundMatch = 1 break if (foundMatch): break else: fullfile = os.path.join(dir, file) if (os.path.exists(fullfile)): doPrint('[ found match %s ]' % fullfile) foundMatch = 1 break if (not foundMatch): doPrint('[ did not find match for %s in %s ]' % (file, string.join(dirs, ':'))) return 0 return 1 def searchForFile(dir, reqdFile, foundDirs): try: files = os.listdir(dir) except: return for file in files: fullfile = os.path.join(dir, file) if os.path.isdir(fullfile): searchForFile(fullfile, reqdFile, foundDirs) elif file == reqdFile: foundDirs.append(dir) def searchForReqdFile(dir, reqdFile): foundDirs = [] searchForFile(dir, reqdFile, foundDirs) if not foundDirs: doPrint('[ did not find %s in %s/* ]' % (reqdFile, dir)) return None n = len(foundDirs) if n == 1: foundDir = foundDirs[0] doPrint('[ found %s in %s ]' % (reqdFile, foundDir)) else: doPrint('Found %d copies of %s in %s/*:' % (n, reqdFile, dir)) for i in range(n): doPrint(' %d: %s' % (i+1, foundDirs[i])) while 1: m = getInput('Which number do you want (1 to %d)?' % n, doLower=0) try: m = int(m) if m > 0 and m <= n: foundDir = foundDirs[m-1] break except: pass doPrint('[ using %s for %s ]' % (foundDir, reqdFile)) return foundDir def allFilesFound(dir, reqdInclFiles, reqdLibFiles, allowMultiDirs = 0, searchForInclude = 0): if searchForInclude: assert not allowMultiDirs assert len(reqdInclFiles) == 1, '%s' % (len(reqdInclFiles)) if len(dir) > 1 and dir[-1] == os.sep: dir = dir[:-1] incl_dir = include_dir inclDir = os.path.join(dir, include_dir) if not dirContainsFiles(inclDir, reqdInclFiles, allowMultiDirs): if searchForInclude: incl_dir = searchForReqdFile(inclDir, reqdInclFiles[0]) if not incl_dir: return None incl_dir = incl_dir[len(dir)+1:] else: return None for lib_dir in lib_dirs: libDir = os.path.join(dir, lib_dir) if dirContainsFiles(libDir, reqdLibFiles, allowMultiDirs): if searchForInclude: return (dir, incl_dir, lib_dir) else: return (dir, lib_dir) elif searchForInclude and reqdLibFiles: lib_dir = searchForReqdFile(libDir, reqdLibFiles[0]) if not lib_dir: return None lib_dir = lib_dir[len(dir)+1:] return (dir, incl_dir, lib_dir) return None def getCodeDirs(code, sysDir, relDir, reqdInclFiles, reqdLibFiles, allowMultiDirs = 0, searchForInclude = 0): if allowMultiDirs: w = ' (use : to separate dirs if need more than one dir)' else: w = '' t = '' for dir in (relDir, sysDir): if dir: result = allFilesFound(dir, reqdInclFiles, reqdLibFiles, allowMultiDirs) if result: t = ', and %s does' % dir break if not t: dir = '' if searchForInclude: u = '/*' else: u = '' reqdFiles = '%s%s/[%s] and (%s)/[%s]' % (include_dir, u, string.join(reqdInclFiles, ', '), string.join(lib_dirs, ' or '), string.join(reqdLibFiles, ', ')) doPrint('Need to know where %s directory is, in order to compile %s' % (code, program_name)) doPrint('(This directory should contain %s%s)' % (reqdFiles, t)) if (dir): s = getInput('Guess %s dir = "%s", is this correct (y or n)?' % (code, dir)) if (s == 'y'): result = allFilesFound(dir, reqdInclFiles, reqdLibFiles, allowMultiDirs, searchForInclude) if result: return result else: dir = getInput('Where is the %s dir?%s [%s]' % (code, w, dir), doLower=0, default=dir) else: dir = getInput('Where is the %s dir?%s' % (code, w), doLower=0) result = allFilesFound(dir, reqdInclFiles, reqdLibFiles, allowMultiDirs, searchForInclude) while (not result): doPrint('Could not find required files %s in %s' % (reqdFiles, dir)) dir = getInput('Where is the %s dir?%s' % (code, w), doLower=0) result = allFilesFound(dir, reqdInclFiles, reqdLibFiles, allowMultiDirs, searchForInclude) return result def getCodeVersion(code, version, prefix, suffix = '', places = 3): (dir, tail) = os.path.split(prefix) n = len(tail) files = os.listdir(dir) foundVersion = 0 for file in files: if (file[:n] == tail): version = file[n:n+places] if (version): try: float(version) # see if it's a floating point number foundVersion = 1 break except: pass if (foundVersion): s = getInput('Guess %s version = %s (by looking), is this ok (y or n) (reply y unless sure otherwise)?' % (code, version)) else: s = 'n' if (s != 'y'): version = getInput('What %s version do you have (e.g. %s; %s%s%s or similar should exist)?' % (code, version, prefix, version, suffix), doLower=0) return version def packedFileExists(dir, file): return os.path.exists(os.path.join(dir, file)) def unpackedDirExists(dir1, dir2): return os.path.exists(os.path.join(dir1, dir2)) def main(log_file = None): global tcl_rel_dir, tk_rel_dir, python_rel_dir global tcltk_version, python_version, fp_log global lib_dirs if (log_file): fp_log = open(log_file, 'w') else: fp_log = None platform = getPlatform() if (platform == 'darwin'): sysDir = '/sw' else: sysDir = '/usr' if (platform != 'darwin'): s = getInput('Are you using 64 bit libraries? (answer n unless you know otherwise) (y or n))?') if (s[0] == 'y'): lib_dirs = ('lib64', 'lib') elif platform == 'irix': lib_dirs = ('lib32', 'lib') if platform == 'irix': x11_default_dir = '/usr' else: x11_default_dir = '/usr/X11R6' x11_abs_dir = x11_lib_dir = '' tcl_abs_dir = tcl_lib_dir = '' tcl_incl_dir = include_dir tk_abs_dir = tk_lib_dir = '' tk_incl_dir = include_dir mesa_abs_dir = mesa_lib_dir = '' if (distribution != api_distribution): tcl_abs_dir = '%s/%s' % (top_dir, tcl_rel_dir) tcl_lib_dir = 'lib' tk_abs_dir = '%s/%s' % (top_dir, tk_rel_dir) tk_lib_dir = 'lib' if platform != 'darwin': if packedFileExists(tcl_rel_dir, tcl_tar_file_gz) or unpackedDirExists(tcl_rel_dir, tcl_tar_dir): doPrint('You have choice of installing provided Tcl%s or using Tcl already installed on your computer.' % tcltk_version) else: tcl_abs_dir = sysDir doPrint('Assuming you have already installed Tcl on your computer (if you want to use our Tcl%s you will need to download it first).' % tcltk_version) if packedFileExists(tcl_rel_dir, tcl_tar_file_gz): s = getInput('Unpack Tcl%s (y or n)?' % tcltk_version) else: s = 'n' if (s[0] == 'y'): unpackTcl() if unpackedDirExists(tcl_rel_dir, tcl_tar_dir): s = getInput('Compile and install our (unpacked) Tcl%s (y or n)?' % tcltk_version) else: s = 'n' if (s[0] == 'y'): compileTcl() else: (tk_abs_dir, tk_incl_dir, tk_lib_dir) = (tcl_abs_dir, tcl_incl_dir, tcl_lib_dir) = getCodeDirs('Tcl', sysDir, tcl_abs_dir, ('tcl.h',), ('tclConfig.sh',), searchForInclude=1) tcltk_version = getCodeVersion('Tcl/Tk', tcltk_version, '%s/%s/libtcl' % (tcl_abs_dir, tcl_lib_dir), '.so') tcl_rel_dir = 'tcl%s' % tcltk_version else: # darwin result = allFilesFound(sysDir, ('tcl.h',), ('tclConfig.sh',)) if result: print 'Using the Fink version of Tcl (in %s)' % sysDir (tcl_abs_dir, tcl_lib_dir) = result tcltk_version = getCodeVersion('Tcl/Tk', tcltk_version, '%s/%s/libtcl' % (tcl_abs_dir, tcl_lib_dir), '.so') tcl_rel_dir = 'tcl%s' % tcltk_version else: print 'Missing Fink-installed Tcl, please install first (also check for Tk and Python)' sys.exit(1) if (platform != 'darwin') and (tcltk_release[:len(tcltk_version)] == tcltk_version): if packedFileExists(tk_rel_dir, tk_tar_file_gz) or unpackedDirExists(tk_rel_dir, tk_tar_dir): doPrint('You have choice of installing provided Tk%s or using Tk already installed on your computer.' % tcltk_version) else: tk_abs_dir = sysDir doPrint('Assuming you have already installed Tk on your computer (if you want to use our Tk%s you will need to download it first).' % tcltk_version) if packedFileExists(tk_rel_dir, tk_tar_file_gz): s = getInput('Unpack Tk%s (y or n)?' % tcltk_version) else: s = 'n' if (s[0] == 'y'): unpackTk() if unpackedDirExists(tcl_rel_dir, tcl_tar_dir): s = getInput('Compile and install our (unpacked) Tk%s (y or n)?' % tcltk_version) else: s = 'n' if (s[0] == 'y'): compileTk(tcl_abs_dir) # note, this should indeed be tcl_abs_dir, not tk_abs_dir else: (tk_abs_dir, tk_incl_dir, tk_lib_dir) = getCodeDirs('Tk', sysDir, tk_abs_dir, ('tk.h',), ('tkConfig.sh',), searchForInclude=1) doPrint('Assuming Tk version is also %s' % tcltk_version) tk_rel_dir = 'tk%s' % tcltk_version elif platform != 'darwin': (tk_abs_dir, tk_lib_dir) = getCodeDirs('Tk', sysDir, tk_abs_dir, ('tk.h',), ('tkConfig.sh',)) doPrint('Assuming Tk version is also %s' % tcltk_version) tk_rel_dir = 'tk%s' % tcltk_version else: # darwin result = allFilesFound(sysDir, ('tk.h',), ('tkConfig.sh',)) if result: print 'Using the Fink version of Tk (in %s)' % sysDir (tk_abs_dir, tk_lib_dir) = result doPrint('Assuming Tk version is also %s' % tcltk_version) tk_rel_dir = 'tk%s' % tcltk_version else: print 'Missing Fink-installed Tk, please install first (also check for Python)' sys.exit(1) if tcl_abs_dir and tk_abs_dir: tcl_lib_path = os.path.join(tcl_abs_dir, tcl_lib_dir) tk_lib_path = os.path.join(tk_abs_dir, tk_lib_dir) tcl_incl_path = os.path.join(tcl_abs_dir, tcl_incl_dir) tk_incl_path = os.path.join(tk_abs_dir, tk_incl_dir) else: tcl_lib_path = tk_lib_path = '' tcl_incl_path = tk_incl_path = '' version = '0.0' # arbitrary while (float(version) < float(min_python_version)): python_abs_dir = '%s/%s' % (top_dir, python_rel_dir) python_lib_dir = 'lib' #python_bin_dir = '../%s' % python_rel_dir python_bin_dir = python_abs_dir if platform != 'darwin': if packedFileExists(python_rel_dir, python_tar_file_gz) or unpackedDirExists(python_rel_dir, python_tar_dir): doPrint('You have choice of installing provided Python%s or using Python already installed on your computer.' % python_version) else: python_abs_dir = sysDir doPrint('Assuming you have already installed Python on your computer (if you want to use our Python%s you will need to download it first).' % python_version) doPrint('It must be %s or higher, and it must have Tcl/Tk compiled in (latter not checked here).' % min_python_version) if packedFileExists(python_rel_dir, python_tar_file_gz): s = getInput('Unpack Python%s (y or n)?' % python_version) else: s = 'n' if (s[0] == 'y'): unpackPython() if unpackedDirExists(python_rel_dir, python_tar_dir): s = getInput('Compile and install our (unpacked) Python%s (y or n)?' % python_version) else: s = 'n' if (s[0] == 'y'): result = allFilesFound(x11_default_dir, ('X11/Xlib.h',), ('libX11.*',)) if not result: x11_default_dir = '/usr' # some Linuxes use this it seems result = allFilesFound(x11_default_dir, ('X11/Xlib.h',), ('libX11.*',)) if result: print 'Using the standard version of X11 (in %s)' % x11_default_dir (x11_abs_dir, x11_lib_dir) = result else: (x11_abs_dir, x11_lib_dir) = getCodeDirs('X11', x11_default_dir, '', ('X11/Xlib.h',), ('libX11.*',)) x11_lib_path = '%s/%s' % (x11_abs_dir, x11_lib_dir) compilePython(x11_abs_dir, tcl_abs_dir, tk_abs_dir, x11_lib_path, tcl_lib_path, tk_lib_path, tcl_incl_path, tk_incl_path) version = python_version else: dir = python_rel_dir[:-1] + '*' (python_abs_dir, python_lib_dir) = getCodeDirs('Python', sysDir, python_abs_dir, (dir,), (dir,)) python_bin_dir = python_abs_dir version = getCodeVersion('Python', python_version, '%s/include/python' % python_abs_dir) if (float(version) < float(min_python_version)): doPrint('Minimum Python usable is %s, try again.' % min_python_version) else: python_rel_dir = 'python%s' % version python_version = version else: # darwin dir = python_rel_dir[:-1] + '*' result = allFilesFound(sysDir, (dir,), (dir,)) if result: print 'Using the Fink version of Python (in %s)' % sysDir (python_abs_dir, python_lib_dir) = result python_bin_dir = python_abs_dir version = getCodeVersion('Python', python_version, '%s/include/python' % python_abs_dir) if (float(version) < float(min_python_version)): doPrint('Minimum Python usable is %s, try again.' % min_python_version) else: python_rel_dir = 'python%s' % version python_version = version else: print 'Missing Fink-installed Python, please install first' sys.exit(1) if (distribution == analysis_distribution): s = getInput('Do you want OpenGL used in Analysis (y or n) (n means only get Tk)?') if (s[0] == 'y'): doOpenGL = 1 else: doOpenGL = 0 useFrameworkGlut = 0 if (doOpenGL): mesa_abs_dir = '%s/%s' % (top_dir, mesa_rel_dir) mesa_lib_dir = 'lib' if platform != 'darwin': if (packedFileExists(mesa_rel_dir, mesa_tar_file1_gz) and packedFileExists(mesa_rel_dir, mesa_tar_file2_gz)) or unpackedDirExists(mesa_rel_dir, mesa_tar_dir): doPrint('You have choice of installing provided Mesa%s or using OpenGL or Mesa already installed on your computer.' % mesa_version) else: mesa_abs_dir = sysDir doPrint('Assuming you have already installed OpenGL or Mesa on your computer (if you want to use our Mesa%s you will need to download it first).' % mesa_version) if packedFileExists(mesa_rel_dir, mesa_tar_file1_gz) and packedFileExists(mesa_rel_dir, mesa_tar_file2_gz): s = getInput('Unpack Mesa%s (y or n)?' % mesa_version) else: s = 'n' if (s[0] == 'y'): unpackMesa() if unpackedDirExists(mesa_rel_dir, mesa_tar_dir): s = getInput('Compile and install Mesa%s (y or n)?' % mesa_version) else: s = 'n' if (s[0] == 'y'): comp_arch = getCompArch(platform) compileMesa(comp_arch) else: doPrint('Assuming OpenGL and glut are installed in at most two directories, otherwise this script will not work and you will need to edit environment.txt by hand.') doPrint('You should be ok if you are using Mesa and installed both MesaLib and MesaDemos (in which case should only need one directory).') (mesa_abs_dir, mesa_lib_dir) = getCodeDirs('OpenGL or Mesa', sysDir, mesa_abs_dir, ('GL/gl.h',), ('libGL.*', 'libglut.*'), allowMultiDirs=1) else: # darwin s = getInput('Do you want to use OSX framework version of glut (y or n) (answer y unless you know otherwise)?') if (s[0] == 'y'): useFrameworkGlut = 1 if useFrameworkGlut: result = allFilesFound(x11_default_dir, ('GL/gl.h',), ('libGL.*',)) if result: print 'Using the standard version of OpenGL (in %s) and (framework) glut' % x11_default_dir (mesa_abs_dir, mesa_lib_dir) = result else: (mesa_abs_dir, mesa_lib_dir) = getCodeDirs('OpenGL', x11_default_dir, x11_abs_dir, ('GL/gl.h',), ('libGL.*',)) else: mesa_abs_dir = sysDir doPrint('Assuming OpenGL and glut are installed in at most two directories, otherwise this script will not work and you will need to edit environment.txt by hand.') (mesa_abs_dir, mesa_lib_dir) = getCodeDirs('OpenGL', sysDir, mesa_abs_dir, ('GL/gl.h',), ('libGL.*', 'libglut.*'), allowMultiDirs=1) s = getInput('Compile and install %s code (y or n)?' % program_name) if (s[0] == 'y'): doPrint('You can create environment file from scratch (this does not copy it from environment_default.txt)') doPrint('If you have already created it and edited it by hand you probably do not want to create it again here.') s = getInput('Create environment file (y or n) (answer y unless you know otherwise)?') if (s[0] == 'y'): needGlutInit = 0 if (doOpenGL): s = getInput('Does your glut need explicit initialisation (OSX and freeglut probably y, ordinary glut probably n) (y or n)?') if (s[0] == 'y'): needGlutInit = 1 s = getInput('Use -fPIC compiler flag (y or n) (if gcc compiler y, otherwise n; answer y unless you know otherwise)?') if (s[0] == 'y'): usePic = 1 else: usePic = 0 if not x11_abs_dir: result = allFilesFound(x11_default_dir, ('X11/Xlib.h',), ('libX11.*',)) if not result: x11_default_dir = '/usr' # some Linuxes use this it seems result = allFilesFound(x11_default_dir, ('X11/Xlib.h',), ('libX11.*',)) if result: print 'Using the standard version of X11 (in %s)' % x11_default_dir (x11_abs_dir, x11_lib_dir) = result else: (x11_abs_dir, x11_lib_dir) = getCodeDirs('X11', x11_default_dir, '', ('X11/Xlib.h',), ('libX11.*',)) createEnvironmentFile(platform, x11_abs_dir, x11_lib_dir, tcl_abs_dir, tcl_lib_dir, tcl_incl_dir, tk_abs_dir, tk_lib_dir, tk_incl_dir, python_abs_dir, python_lib_dir, mesa_abs_dir, mesa_lib_dir, doOpenGL, needGlutInit, useFrameworkGlut, usePic) compileAnalysis(python_abs_dir) createSymbolicLinks() if (distribution != api_distribution): mesa_dirs = string.split(mesa_abs_dir, ':') mesa_lib_path = '' for dir in mesa_dirs: if dir: mesa_lib_path = mesa_lib_path + ':%s/%s' % (dir, mesa_lib_dir) s = getInput('Do you want to create a bin directory (answer y unless you know otherwise) (y or n)?') if (s[0] == 'y'): shell = getShell() if (shell in ('bash', )): useExport = 1 elif (shell in ('csh', 'tcsh')): useExport = 0 else: s = getInput('Does your shell use export (rather than setenv) (bash y, tcsh and csh n, not sure about others) (y or n)?') if (s[0] == 'y'): useExport = 1 else: useExport = 0 doPrint('Creating the bin directory') createBin(python_bin_dir, tcl_lib_path, tk_lib_path, mesa_lib_path, useExport) doUpgrade() if (distribution == format_distribution): s = getInput('Run FormatConverter (as test) (y or n)?') if (s[0] == 'y'): runProgram(format_program, tcl_lib_path, tk_lib_path, mesa_lib_path) elif (distribution == analysis_distribution): s = getInput('Run Analysis (as test) (y or n)?') if (s[0] == 'y'): runProgram(analysis_program, tcl_lib_path, tk_lib_path, mesa_lib_path) doPrint('Finished installation script') if (fp_log): fp_log.close() if (__name__ == '__main__'): if (ccpnmr_rel_dir is None): ccpnmr_rel_dir = 'ccpnmr1.0' top_dir = os.getcwd() if (len(sys.argv) >= 2): distribution = string.lower(sys.argv[1]) if (distribution not in distributions): print 'Error: require one argument: distribution' print 'where distribution = one of %s' % str(distributions) sys.exit(1) program_name = program_names[distribution] n = 1 log_file = 'log_%s_%d.txt' % (program_name, n) while (os.path.exists(log_file)): n = n + 1 log_file = 'log_%s_%d.txt' % (program_name, n) print 'Messages will be logged in "%s"' % log_file main(log_file)

Top of Message | Previous Page | Permalink

JISCMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
December 2003
November 2003
October 2003
September 2003


WWW.JISCMAIL.AC.UK

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager