Mercurial > pymonkey
comparison setup.py @ 170:dd32a92f6b4f
Initial attempt at renaming pymonkey to pydermonkey.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Tue, 01 Sep 2009 03:07:24 -0700 |
parents | b4e216d06e83 |
children |
comparison
equal
deleted
inserted
replaced
169:2b98d4643c44 | 170:dd32a92f6b4f |
---|---|
35 import distutils.core | 35 import distutils.core |
36 | 36 |
37 from paver.easy import * | 37 from paver.easy import * |
38 from paver.setuputils import setup | 38 from paver.setuputils import setup |
39 | 39 |
40 SOURCE_FILES = ['pymonkey.cpp', | 40 SOURCE_FILES = ['pydermonkey.cpp', |
41 'utils.cpp', | 41 'utils.cpp', |
42 'object.cpp', | 42 'object.cpp', |
43 'function.cpp', | 43 'function.cpp', |
44 'script.cpp', | 44 'script.cpp', |
45 'undefined.cpp', | 45 'undefined.cpp', |
60 SPIDERMONKEY_MAKEFILE = os.path.join(SPIDERMONKEY_OBJDIR, 'Makefile') | 60 SPIDERMONKEY_MAKEFILE = os.path.join(SPIDERMONKEY_OBJDIR, 'Makefile') |
61 | 61 |
62 DOCTEST_OUTPUT_DIR = os.path.join(BUILD_DIR, 'doctest_output') | 62 DOCTEST_OUTPUT_DIR = os.path.join(BUILD_DIR, 'doctest_output') |
63 | 63 |
64 setup_options = dict( | 64 setup_options = dict( |
65 name='pymonkey', | 65 name='pydermonkey', |
66 version='0.0.1', | 66 version='0.0.1', |
67 description='Access SpiderMonkey from Python', | 67 description='Access SpiderMonkey from Python', |
68 author='Atul Varma', | 68 author='Atul Varma', |
69 author_email='atul@mozilla.com', | 69 author_email='atul@mozilla.com', |
70 url='http://www.toolness.com' | 70 url='http://www.toolness.com' |
90 ] | 90 ] |
91 else: | 91 else: |
92 ext_options['libraries'] = ['js_static'] | 92 ext_options['libraries'] = ['js_static'] |
93 | 93 |
94 setup_options['ext_modules'] = [ | 94 setup_options['ext_modules'] = [ |
95 distutils.core.Extension('pymonkey', | 95 distutils.core.Extension('pydermonkey', |
96 [os.path.join("src", filename) | 96 [os.path.join("src", filename) |
97 for filename in SOURCE_FILES], | 97 for filename in SOURCE_FILES], |
98 **ext_options) | 98 **ext_options) |
99 ] | 99 ] |
100 | 100 |
101 setup(**setup_options) | 101 setup(**setup_options) |
102 | 102 |
103 @task | 103 @task |
104 def docs(options): | 104 def docs(options): |
105 """Open the Pymonkey documentation in your web browser.""" | 105 """Open the Pydermonkey documentation in your web browser.""" |
106 | 106 |
107 url = os.path.abspath(os.path.join("docs", "rendered", "index.html")) | 107 url = os.path.abspath(os.path.join("docs", "rendered", "index.html")) |
108 url = urllib.pathname2url(url) | 108 url = urllib.pathname2url(url) |
109 webbrowser.open(url) | 109 webbrowser.open(url) |
110 | 110 |
162 sys.exit(retval) | 162 sys.exit(retval) |
163 | 163 |
164 @task | 164 @task |
165 @needs('build_spidermonkey', 'setuptools.command.build') | 165 @needs('build_spidermonkey', 'setuptools.command.build') |
166 def build(options): | 166 def build(options): |
167 """Builds the pymonkey extension.""" | 167 """Builds the pydermonkey extension.""" |
168 | 168 |
169 pass | 169 pass |
170 | 170 |
171 @task | 171 @task |
172 def build_docs(options): | 172 def build_docs(options): |
173 """Build the Pymonkey documentation (requires Sphinx).""" | 173 """Build the Pydermonkey documentation (requires Sphinx).""" |
174 | 174 |
175 retval = subprocess.call(["sphinx-build", | 175 retval = subprocess.call(["sphinx-build", |
176 "-b", "html", | 176 "-b", "html", |
177 os.path.join("docs", "src"), | 177 os.path.join("docs", "src"), |
178 os.path.join("docs", "rendered")]) | 178 os.path.join("docs", "rendered")]) |
204 for name in os.listdir(BUILD_DIR) | 204 for name in os.listdir(BUILD_DIR) |
205 if name.startswith("lib.")][0] | 205 if name.startswith("lib.")][0] |
206 | 206 |
207 @task | 207 @task |
208 def test(options): | 208 def test(options): |
209 """Test the Pymonkey Python C extension.""" | 209 """Test the Pydermonkey Python C extension.""" |
210 | 210 |
211 print "Running test suite." | 211 print "Running test suite." |
212 | 212 |
213 new_env = {} | 213 new_env = {} |
214 new_env.update(os.environ) | 214 new_env.update(os.environ) |
217 paths = new_env.get(env_var, '').split(os.path.pathsep) | 217 paths = new_env.get(env_var, '').split(os.path.pathsep) |
218 paths.append(path) | 218 paths.append(path) |
219 new_env[env_var] = os.path.pathsep.join(paths) | 219 new_env[env_var] = os.path.pathsep.join(paths) |
220 | 220 |
221 # We have to add our build directory to the python path so that | 221 # We have to add our build directory to the python path so that |
222 # our tests can find the pymonkey module. | 222 # our tests can find the pydermonkey module. |
223 append_path('PYTHONPATH', get_lib_dir()) | 223 append_path('PYTHONPATH', get_lib_dir()) |
224 | 224 |
225 if sys.platform == 'win32': | 225 if sys.platform == 'win32': |
226 # If we're on Windows, ensure that the SpiderMonkey DLL | 226 # If we're on Windows, ensure that the SpiderMonkey DLL |
227 # can be loaded. | 227 # can be loaded. |
228 append_path('PATH', SPIDERMONKEY_OBJDIR) | 228 append_path('PATH', SPIDERMONKEY_OBJDIR) |
229 | 229 |
230 result = subprocess.call( | 230 result = subprocess.call( |
231 [sys.executable, | 231 [sys.executable, |
232 os.path.join("tests", "test_pymonkey.py")], | 232 os.path.join("tests", "test_pydermonkey.py")], |
233 env = new_env | 233 env = new_env |
234 ) | 234 ) |
235 | 235 |
236 if result: | 236 if result: |
237 sys.exit(result) | 237 sys.exit(result) |