Commits

Jason R. Coombs committed 68df011

Started work on supporting building on Windows

Comments (0)

Files changed (1)

 objects and functions in Python, and evaluation and calling of JavaScript
 scripts and functions respectively.  Borrows heavily from Claes Jacobssen's
 Javascript Perl module, in turn based on Mozilla's 'PerlConnect' Perl binding.
-""",
+"""
 
 # I haven't the sligthest, but this appears to fix
 # all those EINTR errors. Pulled and adapted for OS X
 # from twisted bug #733
-# 
+#
 # Definitely forgot to comment this out before distribution.
 #
 # import ctypes
 import os
 import subprocess as sp
 import sys
+import platform
 from distutils.dist import Distribution
-import ez_setup
-ez_setup.use_setuptools()
+
 from setuptools import setup, Extension
 
 DEBUG = "--debug" in sys.argv
 def nspr_config(config=None):
     return pkg_config("nspr", config)
 
+def NSPR_config_win(config):
+    raise NotImplementedError("Where to get NSPR libs?")
+
 def js_config(config=None):
     config = pkg_config("mozilla-js", config)
     if "-DJS_THREADSAFE" not in config["extra_compile_args"]:
         raise SystemError("Unable to link against a library that was "
-            "compiled without -DJS_THREADSAFE");
+            "compiled without -DJS_THREADSAFE")
     return config
 
 def platform_config():
-    sysname = os.uname()[0]
-    machine = os.uname()[-1]
+    sysname = platform.system()
+    machine = platform.machine()
 
     # If we're linking against a system library it should give
     # us all the information we need.
     if USE_SYSTEM_LIB:
         return js_config()
-    
+
     # Build our configuration
     config = {
         "extra_compile_args": [
             "-DJS_THREADSAFE",
             "-DPOSIX_SOURCE",
             "-D_BSD_SOURCE",
-            "-Wno-strict-prototypes" # Disable copius JS warnings
         ],
         "include_dirs": [
             "spidermonkey/libjs",
 
     # Currently no suppot for Win32, patches welcome.
     if sysname in ["Darwin", "Linux", "FreeBSD"]:
-        config["extra_compile_args"].append("-DXP_UNIX")
+        config["extra_compile_args"].extend([
+            "-Wno-strict-prototypes",  # Disable copius JS warnings
+            "-DXP_UNIX",
+        ])
+        add_NSPR_config = nspr_config
+    elif sysname == 'Windows':
+        config["extra_compile_args"].extend([
+            "-DXP_WIN"
+        ])
+        add_NSPR_config = NSPR_config_win
     else:
         raise RuntimeError("Unknown system name: %s" % sysname)
 
-    return nspr_config(config=config)
+    return add_NSPR_config(config=config)
 
 Distribution.global_options.append(("debug", None,
                     "Build a DEBUG version of spidermonkey."))
     url = "http://github.com/davisp/python-spidermonkey",
     download_url = "http://github.com/davisp/python-spidermonkey.git",
     zip_safe = False,
-    
+
     classifiers = [
         'Development Status :: 3 - Alpha',
         'Intended Audience :: Developers',
         'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
         'Topic :: Software Development :: Libraries :: Python Modules',
     ],
-    
-    setup_requires = [
-        'setuptools>=0.6c8',
-        'nose>=0.10.0',
-    ],
 
-    ext_modules =  [
+    ext_modules = [
         Extension(
             "spidermonkey",
             sources=find_sources(),
         )
     ],
 
-    test_suite = 'nose.collector',
-
 )