Mercurial > ~astiob > upreckon > hgweb
annotate setup-exe.py @ 184:4df9537ed261
Updated version numbers
author | Oleg Oshmyan <chortos@inbox.lv> |
---|---|
date | Tue, 26 Jul 2011 19:45:24 +0300 |
parents | 37955420fd66 |
children | fe03964896ef |
rev | line source |
---|---|
147
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
1 #! /usr/bin/env python |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
2 from cx_Freeze import setup, Executable, build_exe |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
3 from distutils.core import Extension |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
4 from distutils.command.build_ext import build_ext |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
5 from distutils.errors import CCompilerError |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
6 from distutils import log |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
7 import os |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
8 |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
9 class build_opt_ext(build_ext): |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
10 def build_extension(self, ext): |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
11 try: |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
12 build_ext.build_extension(self, ext) |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
13 except CCompilerError: |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
14 log.warn("Failed to build native extension '%s' (skipping)", |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
15 ext.name) |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
16 |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
17 try: |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
18 from sys import maxsize |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
19 except ImportError: |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
20 from sys import maxint as maxsize |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
21 if maxsize < 2**32: |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
22 arch = 'x86' |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
23 else: |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
24 arch = 'amd64' |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
25 direct = (R'C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\%s' |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
26 R'\Microsoft.VC90.CRT' % arch) |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
27 files = ['msvcr90.dll', 'Microsoft.VC90.CRT.manifest'] |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
28 msvcrt_files = [os.path.join(direct, name) for name in files] |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
29 |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
30 os.rename('upreckon/unix.py', 'upreckon/unix.py~') |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
31 try: |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
32 setup(name='Upreckon', |
184 | 33 version='2.03.0dev', |
147
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
34 author='Oleg Oshmyan', |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
35 author_email='chortos@inbox.lv', |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
36 url='http://chortos.selfip.net/~astiob/test.py/', |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
37 #description='', |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
38 #long_description='', |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
39 download_url='https://bitbucket.org/astiob/upreckon/downloads', |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
40 #platforms=(), |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
41 #license='', |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
42 #ext_modules=[Extension('upreckon._unix', |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
43 # sources=['upreckon/_unixmodule.cpp'])], |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
44 executables=[Executable('upreckon/upreckon')], |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
45 data_files=[('', msvcrt_files)], |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
46 cmdclass={'build_ext': build_opt_ext}, |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
47 ) |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
48 finally: |
37955420fd66
Added a cx_Freeze-based setup-exe.py for Windows
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff
changeset
|
49 os.rename('upreckon/unix.py~', 'upreckon/unix.py') |