diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/setup-exe.py	Sat May 28 19:54:03 2011 +0100
@@ -0,0 +1,49 @@
+#! /usr/bin/env python
+from cx_Freeze import setup, Executable, build_exe
+from distutils.core import Extension
+from distutils.command.build_ext import build_ext
+from distutils.errors import CCompilerError
+from distutils import log
+import os
+
+class build_opt_ext(build_ext):
+	def build_extension(self, ext):
+		try:
+			build_ext.build_extension(self, ext)
+		except CCompilerError:
+			log.warn("Failed to build native extension '%s' (skipping)",
+			         ext.name)
+
+try:
+	from sys import maxsize
+except ImportError:
+	from sys import maxint as maxsize
+if maxsize < 2**32:
+	arch = 'x86'
+else:
+	arch = 'amd64'
+direct = (R'C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\%s'
+          R'\Microsoft.VC90.CRT' % arch)
+files = ['msvcr90.dll', 'Microsoft.VC90.CRT.manifest']
+msvcrt_files = [os.path.join(direct, name) for name in files]
+
+os.rename('upreckon/unix.py', 'upreckon/unix.py~')
+try:
+	setup(name='Upreckon',
+	      version='2.01.0',
+	      author='Oleg Oshmyan',
+	      author_email='chortos@inbox.lv',
+	      url='http://chortos.selfip.net/~astiob/test.py/',
+	      #description='',
+	      #long_description='',
+	      download_url='https://bitbucket.org/astiob/upreckon/downloads',
+	      #platforms=(),
+	      #license='',
+	      #ext_modules=[Extension('upreckon._unix',
+	      #                       sources=['upreckon/_unixmodule.cpp'])],
+	      executables=[Executable('upreckon/upreckon')],
+	      data_files=[('', msvcrt_files)],
+	      cmdclass={'build_ext': build_opt_ext},
+	     )
+finally:
+	os.rename('upreckon/unix.py~', 'upreckon/unix.py')
\ No newline at end of file