[javascriptlint-commit] SF.net SVN: javascriptlint:[378] trunk
Status: Beta
Brought to you by:
matthiasmiller
|
From: <mat...@us...> - 2018-01-02 21:55:27
|
Revision: 378
http://sourceforge.net/p/javascriptlint/code/378
Author: matthiasmiller
Date: 2018-01-02 21:55:24 +0000 (Tue, 02 Jan 2018)
Log Message:
-----------
Hide irrelevant command line options.
Modified Paths:
--------------
trunk/javascriptlint/jsl.py
trunk/setup.py
Modified: trunk/javascriptlint/jsl.py
===================================================================
--- trunk/javascriptlint/jsl.py 2018-01-02 21:42:44 UTC (rev 377)
+++ trunk/javascriptlint/jsl.py 2018-01-02 21:55:24 UTC (rev 378)
@@ -1,11 +1,17 @@
#!/usr/bin/python
# vim: ts=4 sw=4 expandtab
+try:
+ import hotshot
+ import hotshot.stats
+except ImportError:
+ hotshot = None
import fnmatch
import functools
+import optparse
import os
import sys
+import tempfile
import unittest
-from optparse import OptionParser
import conf
import fs
@@ -56,9 +62,6 @@
print "Developed by Matthias Miller (http://www.JavaScriptLint.com)"
def _profile_enabled(func, *args, **kwargs):
- import tempfile
- import hotshot
- import hotshot.stats
handle, filename = tempfile.mkstemp()
profile = hotshot.Profile(filename)
profile.runcall(func, *args, **kwargs)
@@ -70,12 +73,13 @@
func(*args, **kwargs)
def _main():
- parser = OptionParser(usage="%prog [options] [files]")
+ parser = optparse.OptionParser(usage="%prog [options] [files]")
add = parser.add_option
add("--conf", dest="conf", metavar="CONF",
help="set the conf file")
- add("--profile", dest="profile", action="store_true", default=False,
- help="turn on hotshot profiling")
+ if hotshot is not None:
+ add("--profile", dest="profile", action="store_true", default=False,
+ help="turn on hotshot profiling")
add("--recurse", dest="recurse", action="store_true", default=False,
help="recursively search directories on the command line")
if os.name == 'nt':
@@ -85,9 +89,9 @@
add("--enable-wildcards", dest="wildcards", action="store_true",
default=False, help="resolve wildcards in the command line")
add("--dump", dest="dump", action="store_true", default=False,
- help="dump this script")
+ help="dump this script" if not hasattr(sys, 'frozen') else optparse.SUPPRESS_HELP)
add("--unittest", dest="unittest", action="store_true", default=False,
- help="run the python unittests")
+ help="run the python unittests" if not hasattr(sys, 'frozen') else optparse.SUPPRESS_HELP)
add("--quiet", dest="verbosity", action="store_const", const=0,
help="minimal output")
add("--verbose", dest="verbosity", action="store_const", const=2,
Modified: trunk/setup.py
===================================================================
--- trunk/setup.py 2018-01-02 21:42:44 UTC (rev 377)
+++ trunk/setup.py 2018-01-02 21:55:24 UTC (rev 378)
@@ -53,7 +53,8 @@
'_ssl',
'_hashlib',
'socket',
- 'select'
+ 'select',
+ 'hotshot',
],
'bundle_files': 1,
'optimize': 1, # requires 1 to preserve docstrings
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|