| 1 | import py, sys, subprocess |
| 2 | |
| 3 | currpath = py.path.local(__file__).dirpath() |
| 4 | |
| 5 | |
| 6 | def setup_make(targetname): |
| 7 | if sys.platform == 'win32': |
| 8 | popen = subprocess.Popen([sys.executable, "make_dict_win32.py", targetname], cwd=str(currpath), |
| 9 | stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
| 10 | else: |
| 11 | popen = subprocess.Popen(["make", targetname+"Dict.so"], cwd=str(currpath), |
| 12 | stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
| 13 | stdout, _ = popen.communicate() |
| 14 | if popen.returncode: |
| 15 | raise OSError("'make' failed:\n%s" % (stdout,)) |
| 16 | |
| 17 | if sys.hexversion >= 0x3000000: |
| 18 | maxvalue = sys.maxsize |
| 19 | else: |
| 20 | maxvalue = sys.maxint |
| 21 | |
| 22 | IS_WINDOWS = 0 |
| 23 | if 'win32' in sys.platform: |
| 24 | soext = '.dll' |
| 25 | import platform |
| 26 | if '64' in platform.architecture()[0]: |
| 27 | IS_WINDOWS = 64 |
| 28 | maxvalue = 2**31-1 |
| 29 | else: |
| 30 | IS_WINDOWS = 32 |
| 31 | else: |
| 32 | soext = '.so' |