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