comparison setup.py @ 103:257de12e58c4

Added windows build support to setup.py.
author Atul Varma <varmaa@toolness.com>
date Sat, 15 Aug 2009 17:38:03 -0700
parents e455f0f00e98
children 9d4cd0803df5
comparison
equal deleted inserted replaced
102:e455f0f00e98 103:257de12e58c4
46 46
47 if not os.path.exists(SPIDERMONKEY_DIR): 47 if not os.path.exists(SPIDERMONKEY_DIR):
48 print('WARNING: Spidermonkey objdir not found at %s.' % SPIDERMONKEY_DIR) 48 print('WARNING: Spidermonkey objdir not found at %s.' % SPIDERMONKEY_DIR)
49 print('Some build tasks may not run properly.\n') 49 print('Some build tasks may not run properly.\n')
50 50
51 INCLUDE_DIRS = [os.path.join(SPIDERMONKEY_DIR, 'dist', 'include')] 51 setup_options = dict(
52 LIB_DIRS = [os.path.join(SPIDERMONKEY_DIR)] 52 name='pymonkey',
53 version='0.0.1',
54 description='Access SpiderMonkey from Python',
55 author='Atul Varma',
56 author_email='atul@mozilla.com',
57 url='http://www.toolness.com'
58 )
53 59
54 setup(name='pymonkey', 60 ext_options = dict(
55 version='0.0.1', 61 include_dirs = [os.path.join(SPIDERMONKEY_DIR, 'dist', 'include')],
56 description='Access SpiderMonkey from Python', 62 library_dirs = [SPIDERMONKEY_DIR]
57 author='Atul Varma', 63 )
58 author_email='atul@mozilla.com', 64
59 url='http://www.toolness.com', 65 if sys.platform == 'win32':
60 ext_modules=[Extension('pymonkey', 66 # MSVC can't find the js_static.lib SpiderMonkey library, even though
61 SOURCE_FILES, 67 # it exists and distutils is trying to tell it to link to it, so
62 include_dirs = INCLUDE_DIRS, 68 # we'll just link to the DLL on Windows platforms and install
63 library_dirs = LIB_DIRS, 69 # it in a place where Windows can find it at runtime.
64 libraries = ['js_static'])] 70 ext_options['libraries'] = ['js3250']
65 ) 71 ext_options['define_macros'] = [('XP_WIN', 1)]
72 # TODO: This is almost certainly not the ideal way to distribute
73 # a DLL used by a C extension module.
74 setup_options['data_files'] = [
75 ('Lib\\site-packages', [os.path.join(SPIDERMONKEY_DIR,
76 'js3250.dll')])
77 ]
78 else:
79 ext_options['libraries'] = ['js_static']
80
81 setup_options['ext_modules'] = [Extension('pymonkey',
82 SOURCE_FILES,
83 **ext_options)]
84
85 setup(**setup_options)
66 86
67 @task 87 @task
68 def docs(options): 88 def docs(options):
69 """Open the Pymonkey documentation in your web browser.""" 89 """Open the Pymonkey documentation in your web browser."""
70 90