##// END OF EJS Templates
cleanup: make sure we always access members of imported modules...
Mads Kiilerich -
r22198:77142de4 default
parent child Browse files
Show More
@@ -52,6 +52,7 import sys
52 # Enable tracing. Run 'python -m win32traceutil' to debug
52 # Enable tracing. Run 'python -m win32traceutil' to debug
53 if getattr(sys, 'isapidllhandle', None) is not None:
53 if getattr(sys, 'isapidllhandle', None) is not None:
54 import win32traceutil
54 import win32traceutil
55 win32traceutil.SetupForPrint # silence unused import warning
55
56
56 # To serve pages in local charset instead of UTF-8, remove the two lines below
57 # To serve pages in local charset instead of UTF-8, remove the two lines below
57 import os
58 import os
@@ -90,6 +91,6 def __ExtensionFactory__():
90 return isapi_wsgi.ISAPISimpleHandler(handler)
91 return isapi_wsgi.ISAPISimpleHandler(handler)
91
92
92 if __name__=='__main__':
93 if __name__=='__main__':
93 from isapi.install import *
94 from isapi.install import ISAPIParameters, HandleCommandLine
94 params = ISAPIParameters()
95 params = ISAPIParameters()
95 HandleCommandLine(params)
96 HandleCommandLine(params)
@@ -33,12 +33,14 try:
33 except ImportError:
33 except ImportError:
34 try:
34 try:
35 import sha
35 import sha
36 sha.sha # silence unused import warning
36 except ImportError:
37 except ImportError:
37 raise SystemExit(
38 raise SystemExit(
38 "Couldn't import standard hashlib (incomplete Python install).")
39 "Couldn't import standard hashlib (incomplete Python install).")
39
40
40 try:
41 try:
41 import zlib
42 import zlib
43 zlib.compressobj # silence unused import warning
42 except ImportError:
44 except ImportError:
43 raise SystemExit(
45 raise SystemExit(
44 "Couldn't import standard zlib (incomplete Python install).")
46 "Couldn't import standard zlib (incomplete Python install).")
@@ -56,6 +58,7 if isironpython:
56 else:
58 else:
57 try:
59 try:
58 import bz2
60 import bz2
61 bz2.BZ2Compressor # silence unused import warning
59 except ImportError:
62 except ImportError:
60 raise SystemExit(
63 raise SystemExit(
61 "Couldn't import standard bz2 (incomplete Python install).")
64 "Couldn't import standard bz2 (incomplete Python install).")
@@ -129,6 +132,7 def hasfunction(cc, funcname):
129 # py2exe needs to be installed to work
132 # py2exe needs to be installed to work
130 try:
133 try:
131 import py2exe
134 import py2exe
135 py2exe.Distribution # silence unused import warning
132 py2exeloaded = True
136 py2exeloaded = True
133 # import py2exe's patched Distribution class
137 # import py2exe's patched Distribution class
134 from distutils.core import Distribution
138 from distutils.core import Distribution
@@ -148,6 +148,7 def has_cacheable_fs():
148 def has_lsprof():
148 def has_lsprof():
149 try:
149 try:
150 import _lsprof
150 import _lsprof
151 _lsprof.Profiler # silence unused import warning
151 return True
152 return True
152 except ImportError:
153 except ImportError:
153 return False
154 return False
@@ -164,6 +165,7 def has_git():
164 def has_docutils():
165 def has_docutils():
165 try:
166 try:
166 from docutils.core import publish_cmdline
167 from docutils.core import publish_cmdline
168 publish_cmdline # silence unused import
167 return True
169 return True
168 except ImportError:
170 except ImportError:
169 return False
171 return False
@@ -270,6 +272,7 def has_pyflakes():
270 def has_pygments():
272 def has_pygments():
271 try:
273 try:
272 import pygments
274 import pygments
275 pygments.highlight # silence unused import warning
273 return True
276 return True
274 except ImportError:
277 except ImportError:
275 return False
278 return False
@@ -288,6 +291,7 def has_outer_repo():
288 def has_ssl():
291 def has_ssl():
289 try:
292 try:
290 import ssl
293 import ssl
294 ssl.wrap_socket # silence unused import warning
291 import OpenSSL
295 import OpenSSL
292 OpenSSL.SSL.Context
296 OpenSSL.SSL.Context
293 return True
297 return True
@@ -7,16 +7,6 run pyflakes on all tracked files ending
7
7
8 $ hg locate 'set:**.py or grep("^!#.*python")' 2>/dev/null \
8 $ hg locate 'set:**.py or grep("^!#.*python")' 2>/dev/null \
9 > | xargs pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py"
9 > | xargs pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py"
10 contrib/win32/hgwebdir_wsgi.py:*: 'win32traceutil' imported but unused (glob)
11 setup.py:*: 'sha' imported but unused (glob)
12 setup.py:*: 'zlib' imported but unused (glob)
13 setup.py:*: 'bz2' imported but unused (glob)
14 setup.py:*: 'py2exe' imported but unused (glob)
15 tests/hghave.py:*: '_lsprof' imported but unused (glob)
16 tests/hghave.py:*: 'publish_cmdline' imported but unused (glob)
17 tests/hghave.py:*: 'pygments' imported but unused (glob)
18 tests/hghave.py:*: 'ssl' imported but unused (glob)
19 contrib/win32/hgwebdir_wsgi.py:93: 'from isapi.install import *' used; unable to detect undefined names (glob)
20 tests/filterpyflakes.py:58: undefined name 'undefinedname'
10 tests/filterpyflakes.py:58: undefined name 'undefinedname'
21
11
22
12
General Comments 0
You need to be logged in to leave comments. Login now