Bug 1176642 - Defer import of urllib2; r=chmanchester

This prevents 8 module imports from occurring at mach startup time.

As part of this, I discovered a redundant import of "sys" and eliminated
it.
This commit is contained in:
Gregory Szorc 2015-06-25 12:12:15 -07:00
parent 99c0634a40
commit 3e56f45d4a
3 changed files with 6 additions and 4 deletions

View File

@ -10,7 +10,6 @@ import os
import json
import copy
import sys
import urllib2
from mach.decorators import (
CommandArgument,
@ -58,6 +57,7 @@ def docker_image(name):
return '{}/{}:{}'.format(repository, name, version)
def get_task(task_id):
import urllib2
return json.load(urllib2.urlopen("https://queue.taskcluster.net/v1/task/" + task_id))

View File

@ -10,7 +10,6 @@ import argparse
import os
import shutil
import sys
import urllib2
from mozlog import structured
@ -322,6 +321,8 @@ class B2GXPCShellRunner(MozbuildObject):
self.bin_dir = os.path.join(self.distdir, 'bin')
def _download_busybox(self, b2g_home, emulator):
import urllib2
target_device = 'generic'
if emulator == 'x86':
target_device = 'generic_x86'

View File

@ -8,7 +8,6 @@ import sys
import os
import stat
import platform
import urllib2
import errno
from mach.decorators import (
@ -219,8 +218,8 @@ class PastebinProvider(object):
help='Specify the file to upload to pastebin.mozilla.org')
def pastebin(self, language, poster, duration, file):
import sys
import urllib
import urllib2
URL = 'https://pastebin.mozilla.org/'
@ -299,6 +298,8 @@ class FormatProvider(MachCommandBase):
@CommandArgument('--show', '-s', action = 'store_true',
help = 'Show diff output on instead of applying changes')
def clang_format(self, show=False):
import urllib2
plat = platform.system()
fmt = plat.lower() + "/clang-format-3.5"
fmt_diff = "clang-format-diff-3.5"