source: inundation/pmesh/run_setup.py @ 2754

Last change on this file since 2754 was 2141, checked in by duncan, 19 years ago

compiling triangle using setup.

File size: 1014 bytes
Line 
1import os
2import string
3import sys
4import shutil
5
6
7# Work out the directory the pyd will go.
8_s = string.split( sys.version )[0]
9#print "_s",_s
10version_info = tuple( map(int, string.split(_s, '.') ) )
11del _s
12#print "version_info", version_info
13#print "sys.executable",sys.executable
14pyd_in_dir = 'build/lib.%s-%s.%s/'  %(sys.platform,version_info[0],version_info[1])
15
16# See if the pyd has already been compiled.
17try:
18    _ = os.listdir(pyd_in_dir)
19except WindowsError:
20    # The build hasn't got the files we want
21    print "Removing the current build directory"
22    try:
23        shutil.rmtree('build')
24    except:
25        pass
26
27   
28
29if sys.platform == 'win32':  #Windows
30    win32_extra = '-cmingw32'
31
32command = '%s setup.py build %s' %(sys.executable,win32_extra) 
33os.system(command)
34   
35
36#
37
38#print "file_in_dir", file_in_dir
39for file in os.listdir(pyd_in_dir):
40    if os.path.splitext(file)[1] == ".pyd":
41        shutil.copy(os.path.join(pyd_in_dir,file), '.')
42
43
Note: See TracBrowser for help on using the repository browser.