Line | |
---|
1 | import os |
---|
2 | import string |
---|
3 | import sys |
---|
4 | import shutil |
---|
5 | |
---|
6 | |
---|
7 | # Work out the directory the pyd will go. |
---|
8 | _s = string.split( sys.version )[0] |
---|
9 | #print "_s",_s |
---|
10 | version_info = tuple( map(int, string.split(_s, '.') ) ) |
---|
11 | del _s |
---|
12 | #print "version_info", version_info |
---|
13 | #print "sys.executable",sys.executable |
---|
14 | pyd_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. |
---|
17 | try: |
---|
18 | _ = os.listdir(pyd_in_dir) |
---|
19 | except 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 | |
---|
29 | if sys.platform == 'win32': #Windows |
---|
30 | win32_extra = '-cmingw32' |
---|
31 | |
---|
32 | command = '%s setup.py build %s' %(sys.executable,win32_extra) |
---|
33 | os.system(command) |
---|
34 | |
---|
35 | |
---|
36 | # |
---|
37 | |
---|
38 | #print "file_in_dir", file_in_dir |
---|
39 | for 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.