[javascriptlint-commit] SF.net SVN: javascriptlint:[249] trunk
Status: Beta
Brought to you by:
matthiasmiller
|
From: <mat...@us...> - 2009-10-03 15:04:32
|
Revision: 249
http://javascriptlint.svn.sourceforge.net/javascriptlint/?rev=249&view=rev
Author: matthiasmiller
Date: 2009-10-03 15:04:25 +0000 (Sat, 03 Oct 2009)
Log Message:
-----------
Use a different approach to allow pyspidermonkey to be used from the trunk tree.
Modified Paths:
--------------
trunk/jsl.py
trunk/pyjsl/jsparse.py
trunk/pyjsl/lint.py
trunk/pyjsl/warnings.py
trunk/setup.py
trunk/test.py
Added Paths:
-----------
trunk/pyjsl/spidermonkey.py
trunk/pyjsl/spidermonkey_.py
Modified: trunk/jsl.py
===================================================================
--- trunk/jsl.py 2009-10-03 09:35:59 UTC (rev 248)
+++ trunk/jsl.py 2009-10-03 15:04:25 UTC (rev 249)
@@ -7,13 +7,6 @@
import unittest
from optparse import OptionParser
-try:
- import setup
-except ImportError:
- pass
-else:
- setup.addsearchpath()
-
import pyjsl.conf
import pyjsl.htmlparse
import pyjsl.jsparse
Modified: trunk/pyjsl/jsparse.py
===================================================================
--- trunk/pyjsl/jsparse.py 2009-10-03 09:35:59 UTC (rev 248)
+++ trunk/pyjsl/jsparse.py 2009-10-03 15:04:25 UTC (rev 249)
@@ -5,8 +5,8 @@
import re
import unittest
-import pyspidermonkey
-from pyspidermonkey import tok, op
+import spidermonkey
+from spidermonkey import tok, op
_tok_names = dict(zip(
[getattr(tok, prop) for prop in dir(tok)],
@@ -17,7 +17,7 @@
['op.%s' % prop for prop in dir(op)]
))
-NodePos = pyspidermonkey.NodePos
+NodePos = spidermonkey.NodePos
class NodePositions:
" Given a string, allows [x] lookups for NodePos line and column numbers."
@@ -203,8 +203,8 @@
error_callback(line, col, msg)
startpos = startpos or NodePos(0,0)
- return pyspidermonkey.parse(script, _Node, _wrapped_callback,
- startpos.line, startpos.col)
+ return spidermonkey.parse(script, _Node, _wrapped_callback,
+ startpos.line, startpos.col)
def filtercomments(possible_comments, node_positions, root_node):
comment_ignore_ranges = NodeRanges()
@@ -238,7 +238,7 @@
return filtercomments(possible_comments, node_positions, root_node)
def is_compilable_unit(script):
- return pyspidermonkey.is_compilable_unit(script)
+ return spidermonkey.is_compilable_unit(script)
def _dump_node(node, depth=0):
if node is None:
Modified: trunk/pyjsl/lint.py
===================================================================
--- trunk/pyjsl/lint.py 2009-10-03 09:35:59 UTC (rev 248)
+++ trunk/pyjsl/lint.py 2009-10-03 15:04:25 UTC (rev 249)
@@ -10,7 +10,7 @@
import warnings
import util
-from pyspidermonkey import tok, op
+from spidermonkey import tok, op
_newline_kinds = (
'eof', 'comma', 'dot', 'semi', 'colon', 'lc', 'rc', 'lp', 'rb', 'assign',
Added: trunk/pyjsl/spidermonkey.py
===================================================================
--- trunk/pyjsl/spidermonkey.py (rev 0)
+++ trunk/pyjsl/spidermonkey.py 2009-10-03 15:04:25 UTC (rev 249)
@@ -0,0 +1,10 @@
+# vim: ts=4 sw=4 expandtab
+
+# This is a wrapper script to make it easier for development. It tries to
+# import the development version first, and if that fails, it goes after the
+# real version.
+try:
+ from spidermonkey_ import *
+except ImportError:
+ from pyspidermonkey import *
+
Property changes on: trunk/pyjsl/spidermonkey.py
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/pyjsl/spidermonkey_.py
===================================================================
--- trunk/pyjsl/spidermonkey_.py (rev 0)
+++ trunk/pyjsl/spidermonkey_.py 2009-10-03 15:04:25 UTC (rev 249)
@@ -0,0 +1,20 @@
+# vim: ts=4 sw=4 expandtab
+from distutils.core import setup, Extension
+import os
+import sys
+
+# Add the bin directory to the module search path
+def _get_lib_path():
+ import distutils.dist
+ import distutils.command.build
+ dist = distutils.dist.Distribution()
+ build = distutils.command.build.build(dist)
+ build.finalize_options()
+ return os.path.join(os.path.dirname(__file__), '..', build.build_platlib)
+
+sys.path.insert(0, _get_lib_path())
+try:
+ from pyspidermonkey import *
+finally:
+ sys.path.pop(0)
+
Property changes on: trunk/pyjsl/spidermonkey_.py
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/pyjsl/warnings.py
===================================================================
--- trunk/pyjsl/warnings.py 2009-10-03 09:35:59 UTC (rev 248)
+++ trunk/pyjsl/warnings.py 2009-10-03 15:04:25 UTC (rev 249)
@@ -20,8 +20,9 @@
import util
import visitation
-from pyspidermonkey import tok, op
+from spidermonkey import tok, op
+
_ALL_TOKENS = tuple(filter(lambda x: x != tok.EOF, tok.__dict__.values()))
def _get_assigned_lambda(node):
Modified: trunk/setup.py
===================================================================
--- trunk/setup.py 2009-10-03 09:35:59 UTC (rev 248)
+++ trunk/setup.py 2009-10-03 15:04:25 UTC (rev 249)
@@ -4,18 +4,6 @@
import os
import sys
-# Add the bin directory to the module search path
-def get_lib_path():
- import distutils.dist
- import distutils.command.build
- dist = distutils.dist.Distribution()
- build = distutils.command.build.build(dist)
- build.finalize_options()
- return os.path.join(os.path.dirname(__file__), build.build_platlib)
-
-def addsearchpath():
- sys.path.append(get_lib_path())
-
if __name__ == '__main__':
if os.name == 'nt':
library = 'js32'
@@ -50,7 +38,7 @@
console = ['jsl.py'],
options = {
'py2exe': {
- 'excludes': 'setup',
+ 'excludes': ['pyjsl.spidermonkey_'],
'bundle_files': 1
}
},
Modified: trunk/test.py
===================================================================
--- trunk/test.py 2009-10-03 09:35:59 UTC (rev 248)
+++ trunk/test.py 2009-10-03 15:04:25 UTC (rev 249)
@@ -4,13 +4,6 @@
import re
import sys
-try:
- import setup
-except ImportError:
- pass
-else:
- setup.addsearchpath()
-
import pyjsl.conf
import pyjsl.lint
@@ -102,7 +95,7 @@
if ext in ('.htm', '.html', '.js'):
try:
_testfile(file)
- except test.TestError, error:
+ except TestError, error:
haderrors = True
print error
sys.exit(haderrors)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|