Diff
Modified: trunk/Tools/ChangeLog (133503 => 133504)
--- trunk/Tools/ChangeLog 2012-11-05 19:10:39 UTC (rev 133503)
+++ trunk/Tools/ChangeLog 2012-11-05 19:12:18 UTC (rev 133504)
@@ -1,3 +1,36 @@
+2012-11-05 Dirk Pranke <[email protected]>
+
+ lint-webkitpy doesn't autoinstall pylint properly.
+ https://bugs.webkit.org/show_bug.cgi?id=101106
+
+ Reviewed by Ojan Vafai.
+
+ Re-land r133381 with fix; ironically, lint-webkitpy would've
+ complained about the problem. Also modify pylintrc and clean up
+ any other lint errors in the modified files.
+
+ * Scripts/webkitpy/common/system/autoinstall.py:
+ (AutoInstaller._set_up_target_dir):
+ (AutoInstaller):
+ (AutoInstaller._make_package):
+ (AutoInstaller._create_scratch_directory):
+ (AutoInstaller._install):
+ (AutoInstaller.install):
+ * Scripts/webkitpy/pylintrc:
+ * Scripts/webkitpy/thirdparty/__init__.py:
+ (AutoinstallImportHook._ensure_autoinstalled_dir_is_in_sys_path):
+ (AutoinstallImportHook):
+ (AutoinstallImportHook.find_module):
+ (AutoinstallImportHook._install_pylint):
+ (AutoinstallImportHook._install_coverage):
+ (AutoinstallImportHook._install_eliza):
+ (AutoinstallImportHook._install_webpagereplay):
+ (AutoinstallImportHook._install):
+ * Scripts/webkitpy/thirdparty/__init___unittest.py:
+ (ThirdpartyTest.test_import_hook.MockImportHook.__init__):
+ (ThirdpartyTest.test_import_hook):
+ (ThirdpartyTest.test_imports):
+
2012-11-05 KyungTae Kim <[email protected]>
[EFL] Fix build warning in EWebLauncher/main.c
Modified: trunk/Tools/Scripts/webkitpy/common/system/autoinstall.py (133503 => 133504)
--- trunk/Tools/Scripts/webkitpy/common/system/autoinstall.py 2012-11-05 19:10:39 UTC (rev 133503)
+++ trunk/Tools/Scripts/webkitpy/common/system/autoinstall.py 2012-11-05 19:12:18 UTC (rev 133504)
@@ -121,12 +121,15 @@
sys.path.append(target_dir)
if make_package:
- init_path = os.path.join(target_dir, "__init__.py")
- if not os.path.exists(init_path):
- text = ("# This file is required for Python to search this "
- "directory for modules.\n")
- self._write_file(init_path, text, "ascii")
+ self._make_package(target_dir)
+ def _make_package(self, target_dir):
+ init_path = os.path.join(target_dir, "__init__.py")
+ if not os.path.exists(init_path):
+ text = ("# This file is required for Python to search this "
+ "directory for modules.\n")
+ self._write_file(init_path, text, "ascii")
+
def _create_scratch_directory_inner(self, prefix):
"""Create a scratch directory without exception handling.
@@ -154,7 +157,7 @@
temp directory if it does not already exist.
"""
- prefix = target_name + "_"
+ prefix = target_name.replace(os.sep, "_") + "_"
try:
scratch_dir = self._create_scratch_directory_inner(prefix)
except OSError:
@@ -338,11 +341,16 @@
else:
os.remove(target_path)
- # The shutil.move() command creates intermediate directories if they
- # do not exist, but we do not rely on this behavior since we
- # need to create the __init__.py file anyway.
+ # shutil.move() command creates intermediate directories if they do not exist.
shutil.move(source_path, target_path)
+ # ensure all the new directories are importable.
+ intermediate_dirs = os.path.dirname(os.path.relpath(target_path, self._target_dir))
+ parent_dirname = self._target_dir
+ for dirname in intermediate_dirs.split(os.sep):
+ parent_dirname = os.path.join(parent_dirname, dirname)
+ self._make_package(parent_dirname)
+
self._record_url_downloaded(package_name, url)
def install(self, url, should_refresh=False, target_name=None,
@@ -378,7 +386,8 @@
if not should_refresh and self._is_downloaded(target_name, url):
return False
- _log.info("Auto-installing package: %s" % target_name)
+ package_name = target_name.replace(os.sep, '.')
+ _log.info("Auto-installing package: %s" % package_name)
# The scratch directory is where we will download and prepare
# files specific to this install until they are ready to move
@@ -386,7 +395,7 @@
scratch_dir = self._create_scratch_directory(target_name)
try:
- self._install(package_name=target_name,
+ self._install(package_name=package_name,
target_path=target_path,
scratch_dir=scratch_dir,
url=""
Modified: trunk/Tools/Scripts/webkitpy/pylintrc (133503 => 133504)
--- trunk/Tools/Scripts/webkitpy/pylintrc 2012-11-05 19:10:39 UTC (rev 133503)
+++ trunk/Tools/Scripts/webkitpy/pylintrc 2012-11-05 19:12:18 UTC (rev 133504)
@@ -64,6 +64,7 @@
# CHANGED:
# C0103: Invalid name ""
# C0111: Missing docstring
+# C0301: Line too long
# C0302: Too many lines in module (N)
# I0010: Unable to consider inline option ''
# I0011: Locally disabling WNNNN
@@ -93,7 +94,7 @@
# W0614: Unused import X from wildcard import
# W0703: Catch "Exception"
# W1201: Specify string format arguments as logging function parameters
-disable=C0103,C0111,C0302,I0010,I0011,R0201,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0921,R0922,W0122,W0141,W0142,W0212,W0401,W0402,W0404,W0511,W0603,W0614,W0703,W1201
+disable=C0103,C0111,C0301,C0302,I0010,I0011,R0201,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0921,R0922,W0122,W0141,W0142,W0212,W0401,W0402,W0404,W0511,W0603,W0614,W0703,W1201
[REPORTS]
Modified: trunk/Tools/Scripts/webkitpy/thirdparty/__init__.py (133503 => 133504)
--- trunk/Tools/Scripts/webkitpy/thirdparty/__init__.py 2012-11-05 19:10:39 UTC (rev 133503)
+++ trunk/Tools/Scripts/webkitpy/thirdparty/__init__.py 2012-11-05 19:12:18 UTC (rev 133504)
@@ -65,7 +65,12 @@
def __init__(self, filesystem=None):
self._fs = filesystem or FileSystem()
- def find_module(self, fullname, path):
+ def _ensure_autoinstalled_dir_is_in_sys_path(self):
+ # Some packages require that the are being put somewhere under a directory in sys.path.
+ if not _AUTOINSTALLED_DIR in sys.path:
+ sys.path.append(_AUTOINSTALLED_DIR)
+
+ def find_module(self, fullname, _):
# This method will run before each import. See http://www.python.org/dev/peps/pep-0302/
if '.autoinstalled' not in fullname:
return
@@ -98,10 +103,13 @@
"pep8-0.5.0/pep8.py")
def _install_pylint(self):
+ self._ensure_autoinstalled_dir_is_in_sys_path()
did_install_something = False
if not self._fs.exists(self._fs.join(_AUTOINSTALLED_DIR, "pylint")):
- did_install_something = self._install('http://pypi.python.org/packages/source/p/pylint/pylint-0.25.1.tar.gz#md5=728bbc2b339bc3749af013709a7f87a5', 'pylint-0.25.1')
- self._fs.move(self._fs.join(_AUTOINSTALLED_DIR, "pylint-0.25.1"), self._fs.join(_AUTOINSTALLED_DIR, "pylint"))
+ installer = AutoInstaller(target_dir=_AUTOINSTALLED_DIR)
+ did_install_something = installer.install("http://pypi.python.org/packages/source/l/logilab-common/logilab-common-0.58.1.tar.gz#md5=77298ab2d8bb8b4af9219791e7cee8ce", url_subpath="logilab-common-0.58.1", target_name="logilab/common")
+ did_install_something |= installer.install("http://pypi.python.org/packages/source/l/logilab-astng/logilab-astng-0.24.1.tar.gz#md5=ddaf66e4d85714d9c47a46d4bed406de", url_subpath="logilab-astng-0.24.1", target_name="logilab/astng")
+ did_install_something |= installer.install('http://pypi.python.org/packages/source/p/pylint/pylint-0.25.1.tar.gz#md5=728bbc2b339bc3749af013709a7f87a5', url_subpath="pylint-0.25.1", target_name="pylint")
return did_install_something
# autoinstalled.buildbot is used by BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py
@@ -126,18 +134,11 @@
return did_install_something
def _install_coverage(self):
- installer = AutoInstaller(target_dir=_AUTOINSTALLED_DIR)
- did_install_something = installer.install(url="" url_subpath="coverage-3.5.1/coverage")
+ self._ensure_autoinstalled_dir_is_in_sys_path()
+ return self._install(url="" url_subpath="coverage-3.5.1/coverage")
- # Note that coverage needs to be under a directory already in sys.path for its
- # internal imports to work correctly :(.
- if not _AUTOINSTALLED_DIR in sys.path:
- sys.path.append(_AUTOINSTALLED_DIR)
- return did_install_something
-
def _install_eliza(self):
- installer = AutoInstaller(target_dir=_AUTOINSTALLED_DIR)
- return installer.install(url="" target_name="eliza.py")
+ return self._install(url="" target_name="eliza.py")
def _install_irc(self):
# Since irclib and ircbot are two top-level packages, we need to import
@@ -157,14 +158,14 @@
did_install_something = self._install("http://web-page-replay.googlecode.com/files/webpagereplay-1.1.2.tar.gz", "webpagereplay-1.1.2")
self._fs.move(self._fs.join(_AUTOINSTALLED_DIR, "webpagereplay-1.1.2"), self._fs.join(_AUTOINSTALLED_DIR, "webpagereplay"))
- init_path = self._fs.join(_AUTOINSTALLED_DIR, "webpagereplay", "__init__.py")
- if not self._fs.exists(init_path):
- self._fs.write_text_file(init_path, "")
+ module_init_path = self._fs.join(_AUTOINSTALLED_DIR, "webpagereplay", "__init__.py")
+ if not self._fs.exists(module_init_path):
+ self._fs.write_text_file(module_init_path, "")
return did_install_something
- def _install(self, url, url_subpath):
+ def _install(self, url, url_subpath=None, target_name=None):
installer = AutoInstaller(target_dir=_AUTOINSTALLED_DIR)
- return installer.install(url="" url_subpath=url_subpath)
+ return installer.install(url="" url_subpath=url_subpath, target_name=target_name)
_hook = AutoinstallImportHook()
Modified: trunk/Tools/Scripts/webkitpy/thirdparty/__init___unittest.py (133503 => 133504)
--- trunk/Tools/Scripts/webkitpy/thirdparty/__init___unittest.py 2012-11-05 19:10:39 UTC (rev 133503)
+++ trunk/Tools/Scripts/webkitpy/thirdparty/__init___unittest.py 2012-11-05 19:12:18 UTC (rev 133504)
@@ -32,13 +32,14 @@
from webkitpy.thirdparty import AutoinstallImportHook
+
class ThirdpartyTest(unittest.TestCase):
def test_import_hook(self):
# Add another import hook and make sure we get called.
class MockImportHook(AutoinstallImportHook):
def __init__(self):
AutoinstallImportHook.__init__(self)
- self._eliza_installed = False
+ self.eliza_installed = False
def _install_eliza(self):
self.eliza_installed = True
@@ -48,11 +49,26 @@
# The actual AutoinstallImportHook should be installed before us,
# so these modules will get installed before MockImportHook runs.
sys.meta_path.append(mock_import_hook)
+ # unused-variable, import failures - pylint: disable-msg=W0612,E0611,F0401
from webkitpy.thirdparty.autoinstalled import eliza
self.assertTrue(mock_import_hook.eliza_installed)
finally:
sys.meta_path.remove(mock_import_hook)
+ def test_imports(self):
+ # This method tests that we can actually import everything.
+ # unused-variable, import failures - pylint: disable-msg=W0612,E0611,F0401
+ import webkitpy.thirdparty.autoinstalled.buildbot
+ import webkitpy.thirdparty.autoinstalled.coverage
+ import webkitpy.thirdparty.autoinstalled.eliza
+ import webkitpy.thirdparty.autoinstalled.irc.ircbot
+ import webkitpy.thirdparty.autoinstalled.irc.irclib
+ import webkitpy.thirdparty.autoinstalled.mechanize
+ import webkitpy.thirdparty.autoinstalled.pylint
+ import webkitpy.thirdparty.autoinstalled.webpagereplay
+ import webkitpy.thirdparty.autoinstalled.pep8
+
+
if __name__ == '__main__':
unittest.main()