Changeset 57920 in webkit


Ignore:
Timestamp:
Apr 20, 2010 2:29:54 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-04-20 Eric Seidel <eric@webkit.org>

Unreviewed, rolling out r57907.
http://trac.webkit.org/changeset/57907
https://bugs.webkit.org/show_bug.cgi?id=37765

Appears to have broken MacEWS and possibly webkit-patch upload
for svn users. Needs further investigation.

  • Scripts/webkitpy/common/checkout/api.py:
  • Scripts/webkitpy/common/checkout/api_unittest.py:
  • Scripts/webkitpy/common/checkout/changelog.py:
  • Scripts/webkitpy/common/checkout/changelog_unittest.py:
  • Scripts/webkitpy/common/checkout/commitinfo.py:
  • Scripts/webkitpy/common/checkout/scm.py:
  • Scripts/webkitpy/common/checkout/scm_unittest.py:
  • Scripts/webkitpy/common/config/committers.py:
  • Scripts/webkitpy/common/net/bugzilla.py:
  • Scripts/webkitpy/common/net/buildbot.py:
  • Scripts/webkitpy/common/net/buildbot_unittest.py:
  • Scripts/webkitpy/common/net/statusserver.py:
  • Scripts/webkitpy/common/prettypatch.py:
  • Scripts/webkitpy/common/system/autoinstall.py:
  • Scripts/webkitpy/common/system/deprecated_logging.py:
  • Scripts/webkitpy/common/system/executive.py:
  • Scripts/webkitpy/common/system/executive_unittest.py:
  • Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:
  • Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py:
  • Scripts/webkitpy/layout_tests/layout_package/metered_stream.py:
  • Scripts/webkitpy/layout_tests/port/mac_unittest.py:
  • Scripts/webkitpy/tool/commands/earlywarningsystem.py:
  • Scripts/webkitpy/tool/commands/queues.py:
  • Scripts/webkitpy/tool/commands/queues_unittest.py:
  • Scripts/webkitpy/tool/commands/upload.py:
  • Scripts/webkitpy/tool/mocktool.py:
  • Scripts/webkitpy/tool/steps/abstractstep.py:
  • Scripts/webkitpy/tool/steps/postdiff.py:
  • Scripts/webkitpy/tool/steps/postdiffforcommit.py:
  • Scripts/webkitpy/tool/steps/postdiffforrevert.py:
  • Scripts/webkitpy/tool/steps/steps_unittest.py:
Location:
trunk/WebKitTools
Files:
32 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r57918 r57920  
     12010-04-20  Eric Seidel  <eric@webkit.org>
     2
     3        Unreviewed, rolling out r57907.
     4        http://trac.webkit.org/changeset/57907
     5        https://bugs.webkit.org/show_bug.cgi?id=37765
     6
     7        Appears to have broken MacEWS and possibly webkit-patch upload
     8        for svn users.  Needs further investigation.
     9
     10        * Scripts/webkitpy/common/checkout/api.py:
     11        * Scripts/webkitpy/common/checkout/api_unittest.py:
     12        * Scripts/webkitpy/common/checkout/changelog.py:
     13        * Scripts/webkitpy/common/checkout/changelog_unittest.py:
     14        * Scripts/webkitpy/common/checkout/commitinfo.py:
     15        * Scripts/webkitpy/common/checkout/scm.py:
     16        * Scripts/webkitpy/common/checkout/scm_unittest.py:
     17        * Scripts/webkitpy/common/config/committers.py:
     18        * Scripts/webkitpy/common/net/bugzilla.py:
     19        * Scripts/webkitpy/common/net/buildbot.py:
     20        * Scripts/webkitpy/common/net/buildbot_unittest.py:
     21        * Scripts/webkitpy/common/net/statusserver.py:
     22        * Scripts/webkitpy/common/prettypatch.py:
     23        * Scripts/webkitpy/common/system/autoinstall.py:
     24        * Scripts/webkitpy/common/system/deprecated_logging.py:
     25        * Scripts/webkitpy/common/system/executive.py:
     26        * Scripts/webkitpy/common/system/executive_unittest.py:
     27        * Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:
     28        * Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py:
     29        * Scripts/webkitpy/layout_tests/layout_package/metered_stream.py:
     30        * Scripts/webkitpy/layout_tests/port/mac_unittest.py:
     31        * Scripts/webkitpy/tool/commands/earlywarningsystem.py:
     32        * Scripts/webkitpy/tool/commands/queues.py:
     33        * Scripts/webkitpy/tool/commands/queues_unittest.py:
     34        * Scripts/webkitpy/tool/commands/upload.py:
     35        * Scripts/webkitpy/tool/mocktool.py:
     36        * Scripts/webkitpy/tool/steps/abstractstep.py:
     37        * Scripts/webkitpy/tool/steps/postdiff.py:
     38        * Scripts/webkitpy/tool/steps/postdiffforcommit.py:
     39        * Scripts/webkitpy/tool/steps/postdiffforrevert.py:
     40        * Scripts/webkitpy/tool/steps/steps_unittest.py:
     41
    1422010-04-20  Nate Chapin  <japhet@chromium.org>
    243
  • trunk/WebKitTools/Scripts/webkitpy/common/checkout/api.py

    r57907 r57920  
    5151    def _latest_entry_for_changelog_at_revision(self, changelog_path, revision):
    5252        changelog_contents = self._scm.contents_at_revision(changelog_path, revision)
    53         fake_file = StringIO.StringIO(changelog_contents.encode("utf-8"))
    54         return ChangeLog.parse_latest_entry_from_file(fake_file)
     53        return ChangeLog.parse_latest_entry_from_file(StringIO.StringIO(changelog_contents))
    5554
    5655    def changelog_entries_for_revision(self, revision):
  • trunk/WebKitTools/Scripts/webkitpy/common/checkout/api_unittest.py

    r57907 r57920  
    2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828
    29 import codecs
    3029import os
    3130import shutil
     
    4140# FIXME: Copied from scm_unittest.py
    4241def write_into_file_at_path(file_path, contents):
    43     new_file = codecs.open(file_path, "w", "utf-8")
     42    new_file = open(file_path, 'w')
    4443    new_file.write(contents)
    4544    new_file.close()
    4645
    4746
    48 _changelog1entry1 = u"""2010-03-25  Tor Arne Vestb\u00f8  <vestbo@webkit.org>
     47_changelog1entry1 = """2010-03-25  Eric Seidel  <eric@webkit.org>
    4948
    5049        Unreviewed build fix to un-break webkit-patch land.
     
    5554        * Scripts/webkitpy/common/checkout/api.py: import scm.CommitMessage
    5655"""
    57 _changelog1entry2 = u"""2010-03-25  Adam Barth  <abarth@webkit.org>
     56_changelog1entry2 = """2010-03-25  Adam Barth  <abarth@webkit.org>
    5857
    5958        Reviewed by Eric Seidel.
     
    6463        * Scripts/webkitpy/common/checkout/api.py:
    6564"""
    66 _changelog1 = u"\n".join([_changelog1entry1, _changelog1entry2])
    67 _changelog2 = u"""2010-03-25  Tor Arne Vestb\u00f8  <vestbo@webkit.org>
     65_changelog1 = "\n".join([_changelog1entry1, _changelog1entry2])
     66_changelog2 = """2010-03-25  Eric Seidel  <eric@webkit.org>
    6867
    6968        Unreviewed build fix to un-break webkit-patch land.
     
    8180
    8281class CommitMessageForThisCommitTest(unittest.TestCase):
    83     expected_commit_message = u"""2010-03-25  Tor Arne Vestb\u00f8  <vestbo@webkit.org>
     82    expected_commit_message = """2010-03-25  Eric Seidel  <eric@webkit.org>
    8483
    8584        Unreviewed build fix to un-break webkit-patch land.
     
    8988
    9089        * Scripts/webkitpy/common/checkout/api.py: import scm.CommitMessage
    91 2010-03-25  Tor Arne Vestb\u00f8  <vestbo@webkit.org>
     902010-03-25  Eric Seidel  <eric@webkit.org>
    9291
    9392        Unreviewed build fix to un-break webkit-patch land.
     
    139138        commitinfo = checkout.commit_info_for_revision(4)
    140139        self.assertEqual(commitinfo.bug_id(), 36629)
    141         self.assertEqual(commitinfo.author_name(), u"Tor Arne Vestb\u00f8")
    142         self.assertEqual(commitinfo.author_email(), "vestbo@webkit.org")
     140        self.assertEqual(commitinfo.author_name(), "Eric Seidel")
     141        self.assertEqual(commitinfo.author_email(), "eric@webkit.org")
    143142        self.assertEqual(commitinfo.reviewer_text(), None)
    144143        self.assertEqual(commitinfo.reviewer(), None)
  • trunk/WebKitTools/Scripts/webkitpy/common/checkout/changelog.py

    r57907 r57920  
    103103        entry_lines = []
    104104        # The first line should be a date line.
    105         first_line = unicode(changelog_file.readline(), "utf-8")
     105        first_line = changelog_file.readline()
    106106        if not date_line_regexp.match(first_line):
    107107            return None
     
    109109
    110110        for line in changelog_file:
    111             line = unicode(line, "utf-8")
    112111            # If we've hit the next entry, return.
    113112            if date_line_regexp.match(line):
     
    119118    def latest_entry(self):
    120119        # ChangeLog files are always UTF-8, we read them in as such to support Reviewers with unicode in their names.
    121         # We don't use codecs.open here to make the api for parse_latest_entry_from_file clearer.
    122         # If we did, then it would be unclear as to whos reponsibility decoding of the file should be.
    123         changelog_file = open(self.path, "r")
     120        changelog_file = codecs.open(self.path, "r", "utf-8")
    124121        try:
    125122            return self.parse_latest_entry_from_file(changelog_file)
  • trunk/WebKitTools/Scripts/webkitpy/common/checkout/changelog_unittest.py

    r57907 r57920  
    8888
    8989    def test_latest_entry_parse(self):
    90         changelog_contents = u"%s\n%s" % (self._example_entry, self._example_changelog)
    91         changelog_file = StringIO(changelog_contents.encode("utf-8"))
     90        changelog_contents = "%s\n%s" % (self._example_entry, self._example_changelog)
     91        changelog_file = StringIO(changelog_contents)
    9292        latest_entry = ChangeLog.parse_latest_entry_from_file(changelog_file)
    9393        self.assertEquals(latest_entry.contents(), self._example_entry)
     
    122122
    123123    def test_set_reviewer(self):
    124         changelog_contents = u"%s\n%s" % (self._new_entry_boilerplate, self._example_changelog)
     124        changelog_contents = "%s\n%s" % (self._new_entry_boilerplate, self._example_changelog)
    125125        changelog_path = self._write_tmp_file_with_contents(changelog_contents)
    126126        reviewer_name = 'Test Reviewer'
     
    170170
    171171    def _assert_update_for_revert_output(self, args, expected_entry):
    172         changelog_contents = u"%s\n%s" % (self._new_entry_boilerplate, self._example_changelog)
     172        changelog_contents = "%s\n%s" % (self._new_entry_boilerplate, self._example_changelog)
    173173        changelog_path = self._write_tmp_file_with_contents(changelog_contents)
    174174        changelog = ChangeLog(changelog_path)
  • trunk/WebKitTools/Scripts/webkitpy/common/checkout/commitinfo.py

    r57907 r57920  
    2828#
    2929# WebKit's python module for holding information on a commit
     30
     31import StringIO
    3032
    3133from webkitpy.common.checkout.changelog import view_source_url
  • trunk/WebKitTools/Scripts/webkitpy/common/checkout/scm.py

    r57907 r57920  
    146146
    147147    def strip_r_from_svn_revision(self, svn_revision):
    148         match = re.match("^r(?P<svn_revision>\d+)", unicode(svn_revision))
     148        match = re.match("^r(?P<svn_revision>\d+)", svn_revision)
    149149        if (match):
    150150            return match.group('svn_revision')
     
    345345    def changed_files_for_revision(self, revision):
    346346        # As far as I can tell svn diff --summarize output looks just like svn status output.
    347         status_command = ["svn", "diff", "--summarize", "-c", revision]
     347        status_command = ["svn", "diff", "--summarize", "-c", str(revision)]
    348348        return self.run_status_and_extract_filenames(status_command, self._status_regexp("ACDMR"))
    349349
     
    365365
    366366    def committer_email_for_revision(self, revision):
    367         return run_command(["svn", "propget", "svn:author", "--revprop", "-r", revision]).rstrip()
     367        return run_command(["svn", "propget", "svn:author", "--revprop", "-r", str(revision)]).rstrip()
    368368
    369369    def contents_at_revision(self, path, revision):
    370370        remote_path = "%s/%s" % (self._repository_url(), path)
    371         return run_command(["svn", "cat", "-r", revision, remote_path])
     371        return run_command(["svn", "cat", "-r", str(revision), remote_path])
    372372
    373373    def diff_for_revision(self, revision):
    374374        # FIXME: This should probably use cwd=self.checkout_root
    375         return run_command(['svn', 'diff', '-c', revision])
     375        return run_command(['svn', 'diff', '-c', str(revision)])
    376376
    377377    def _repository_url(self):
     
    406406
    407407    def svn_commit_log(self, svn_revision):
    408         svn_revision = self.strip_r_from_svn_revision(svn_revision)
     408        svn_revision = self.strip_r_from_svn_revision(str(svn_revision))
    409409        return run_command(['svn', 'log', '--non-interactive', '--revision', svn_revision]);
    410410
  • trunk/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py

    r57907 r57920  
    2929
    3030import base64
    31 import codecs
    3231import getpass
    3332import os
     
    5958
    6059def write_into_file_at_path(file_path, contents):
    61     file = codecs.open(file_path, "w", "utf-8")
     60    file = open(file_path, 'w')
    6261    file.write(contents)
    6362    file.close()
    6463
    6564def read_from_path(file_path):
    66     file = codecs.open(file_path, "r", "utf-8")
     65    file = open(file_path, 'r')
    6766    contents = file.read()
    6867    file.close()
  • trunk/WebKitTools/Scripts/webkitpy/common/config/committers.py

    r57918 r57920  
    240240    Reviewer("Tim Omernick", "timo@apple.com"),
    241241    Reviewer("Timothy Hatcher", ["timothy@hatcher.name", "timothy@apple.com"], "xenon"),
    242     Reviewer(u"Tor Arne Vestb\u00f8", "vestbo@webkit.org", "torarne"),
     242    Reviewer(u'Tor Arne Vestb\xf8', "vestbo@webkit.org", "torarne"),
    243243    Reviewer("Vicki Murley", "vicki@apple.com"),
    244244    Reviewer("Xan Lopez", ["xan.lopez@gmail.com", "xan@gnome.org", "xan@webkit.org"], "xan"),
  • trunk/WebKitTools/Scripts/webkitpy/common/net/bugzilla.py

    r57907 r57920  
    3333import os.path
    3434import re
    35 import StringIO
    3635import subprocess
    3736
     
    413412                attachment[result_key] = flag['setter']
    414413
    415     def _string_contents(self, soup):
    416         # WebKit's bugzilla instance uses UTF-8.
    417         # BeautifulSoup always returns Unicode strings, however
    418         # the .string method returns a (unicode) NavigableString.
    419         # NavigableString can confuse other parts of the code, so we
    420         # convert from NavigableString to a real unicode() object using unicode().
    421         return unicode(soup.string)
    422 
    423414    def _parse_attachment_element(self, element, bug_id):
    424 
    425415        attachment = {}
    426416        attachment['bug_id'] = bug_id
     
    430420        # FIXME: No need to parse out the url here.
    431421        attachment['url'] = self.attachment_url_for_id(attachment['id'])
    432         attachment['name'] = self._string_contents(element.find('desc'))
    433         attachment['attacher_email'] = self._string_contents(element.find('attacher'))
    434         attachment['type'] = self._string_contents(element.find('type'))
     422        attachment['name'] = unicode(element.find('desc').string)
     423        attachment['attacher_email'] = str(element.find('attacher').string)
     424        attachment['type'] = str(element.find('type').string)
    435425        self._parse_attachment_flag(
    436426                element, 'review', attachment, 'reviewer_email')
     
    443433        bug = {}
    444434        bug["id"] = int(soup.find("bug_id").string)
    445         bug["title"] = self._string_contents(soup.find("short_desc"))
    446         bug["reporter_email"] = self._string_contents(soup.find("reporter"))
    447         bug["assigned_to_email"] = self._string_contents(soup.find("assigned_to"))
    448         bug["cc_emails"] = [self._string_contents(element)
     435        bug["title"] = unicode(soup.find("short_desc").string)
     436        bug["reporter_email"] = str(soup.find("reporter").string)
     437        bug["assigned_to_email"] = str(soup.find("assigned_to").string)
     438        bug["cc_emails"] = [str(element.string)
    449439                            for element in soup.findAll('cc')]
    450440        bug["attachments"] = [self._parse_attachment_element(element, bug["id"]) for element in soup.findAll('attachment')]
     
    543533    def _fill_attachment_form(self,
    544534                              description,
    545                               diff,
     535                              patch_file_object,
    546536                              comment_text=None,
    547537                              mark_for_review=False,
     
    563553        else:
    564554            patch_name ="%s.patch" % timestamp()
    565 
    566         # ClientForm expects a file-like object
    567         patch_file_object = StringIO.StringIO(diff.encode("utf-8"))
    568555        self.browser.add_file(patch_file_object,
    569556                              "text/plain",
     
    573560    def add_patch_to_bug(self,
    574561                         bug_id,
    575                          diff,
     562                         patch_file_object,
    576563                         description,
    577564                         comment_text=None,
     
    592579                          self.bug_server_url, bug_id))
    593580        self.browser.select_form(name="entryform")
    594 
    595581        self._fill_attachment_form(description,
    596                                    diff,
     582                                   patch_file_object,
    597583                                   mark_for_review=mark_for_review,
    598584                                   mark_for_commit_queue=mark_for_commit_queue,
     
    627613                   bug_description,
    628614                   component=None,
    629                    diff=None,
     615                   patch_file_object=None,
    630616                   patch_description=None,
    631617                   cc=None,
     
    652638            self.browser["cc"] = cc
    653639        if blocked:
    654             self.browser["blocked"] = unicode(blocked)
     640            self.browser["blocked"] = str(blocked)
    655641        self.browser["short_desc"] = bug_title
    656642        self.browser["comment"] = bug_description
    657643
    658         if diff:
     644        if patch_file_object:
    659645            self._fill_attachment_form(
    660646                    patch_description,
    661                     diff,
     647                    patch_file_object,
    662648                    mark_for_review=mark_for_review,
    663649                    mark_for_commit_queue=mark_for_commit_queue)
  • trunk/WebKitTools/Scripts/webkitpy/common/net/buildbot.py

    r57907 r57920  
    4545class Builder(object):
    4646    def __init__(self, name, buildbot):
    47         self._name = name
     47        self._name = unicode(name)
    4848        self._buildbot = buildbot
    4949        self._builds_cache = {}
     
    224224        tables = BeautifulSoup(page).findAll("table")
    225225        for table in tables:
    226             table_title = unicode(table.findPreviousSibling("p").string)
     226            table_title = table.findPreviousSibling("p").string
    227227            if table_title not in cls.expected_keys:
    228228                # This Exception should only ever be hit if run-webkit-tests changes its results.html format.
    229                 raise Exception("Unhandled title: %s" % table_title)
     229                raise Exception("Unhandled title: %s" % str(table_title))
    230230            # We might want to translate table titles into identifiers before storing.
    231             parsed_results[table_title] = [unicode(row.find("a").string) for row in table.findAll("tr")]
     231            parsed_results[table_title] = [row.find("a").string for row in table.findAll("tr")]
    232232
    233233        return parsed_results
     
    362362        # First cell is the name
    363363        name_link = status_cells[0].find('a')
    364         builder["name"] = unicode(name_link.string)
     364        builder["name"] = name_link.string
    365365
    366366        self._parse_last_build_cell(builder, status_cells[1])
     
    411411
    412412    def _parse_twisted_file_row(self, file_row):
    413         string_or_empty = lambda soup: unicode(soup.string) if soup.string else u""
     413        string_or_empty = lambda string: str(string) if string else ""
    414414        file_cells = file_row.findAll('td')
    415415        return {
    416             "filename": string_or_empty(file_cells[0].find("a")),
    417             "size": string_or_empty(file_cells[1]),
    418             "type": string_or_empty(file_cells[2]),
    419             "encoding": string_or_empty(file_cells[3]),
     416            "filename" : string_or_empty(file_cells[0].find("a").string),
     417            "size" : string_or_empty(file_cells[1].string),
     418            "type" : string_or_empty(file_cells[2].string),
     419            "encoding" : string_or_empty(file_cells[3].string),
    420420        }
    421421
  • trunk/WebKitTools/Scripts/webkitpy/common/net/buildbot_unittest.py

    r57907 r57920  
    5252    def setUp(self):
    5353        self.buildbot = BuildBot()
    54         self.builder = Builder(u"Test Builder \u2661", self.buildbot)
     54        self.builder = Builder("Test Builder", self.buildbot)
    5555        self._install_fetch_build(lambda build_number: ["test1", "test2"])
    5656
  • trunk/WebKitTools/Scripts/webkitpy/common/net/statusserver.py

    r57907 r57920  
    5353            return
    5454        if patch.bug_id():
    55             self.browser["bug_id"] = unicode(patch.bug_id())
     55            self.browser["bug_id"] = str(patch.bug_id())
    5656        if patch.id():
    57             self.browser["patch_id"] = unicode(patch.id())
     57            self.browser["patch_id"] = str(patch.id())
    5858
    5959    def _add_results_file(self, results_file):
     
    8080        self.browser.open(update_svn_revision_url)
    8181        self.browser.select_form(name="update_svn_revision")
    82         self.browser["number"] = unicode(svn_revision_number)
     82        self.browser["number"] = str(svn_revision_number)
    8383        self.browser["broken_bot"] = broken_bot
    8484        return self.browser.submit().read()
  • trunk/WebKitTools/Scripts/webkitpy/common/prettypatch.py

    r57907 r57920  
    3939        pretty_diff = self.pretty_diff(diff)
    4040        diff_file = tempfile.NamedTemporaryFile(suffix=".html")
    41         diff_file.write(pretty_diff.encode("utf-8"))
     41        diff_file.write(pretty_diff)
    4242        diff_file.flush()
    4343        return diff_file
  • trunk/WebKitTools/Scripts/webkitpy/common/system/autoinstall.py

    r57907 r57920  
    125125        file = open(path, "w")
    126126        try:
    127             file.write(text)  # FIXME: What's the encoding of this file?
     127            file.write(text)
    128128        finally:
    129129            file.close()
  • trunk/WebKitTools/Scripts/webkitpy/common/system/deprecated_logging.py

    r57907 r57920  
    4646        self.files = files
    4747
    48     # Callers should pass an already encoded string for writing.
    49     def write(self, bytes):
     48    def write(self, string):
    5049        for file in self.files:
    51             file.write(bytes)
     50            file.write(string)
    5251
    5352class OutputTee:
  • trunk/WebKitTools/Scripts/webkitpy/common/system/executive.py

    r57907 r57920  
    8989
    9090    def _run_command_with_teed_output(self, args, teed_output):
    91         args = map(unicode, args)  # Popen will throw an exception if args are non-strings (like int())
    9291        child_process = subprocess.Popen(args,
    9392                                         stdout=subprocess.PIPE,
     
    101100            if output_line == "" and child_process.poll() != None:
    102101                return child_process.poll()
    103             # We assume that the child process wrote to us in utf-8,
    104             # so no re-encoding is necessary before writing here.
    105102            teed_output.write(output_line)
    106103
    107     # FIXME: Remove this deprecated method and move callers to run_command.
    108     # FIXME: This method is a hack to allow running command which both
    109     # capture their output and print out to stdin.  Useful for things
    110     # like "build-webkit" where we want to display to the user that we're building
    111     # but still have the output to stuff into a log file.
    112     def run_and_throw_if_fail(self, args, quiet=False, decode_output=True):
     104    def run_and_throw_if_fail(self, args, quiet=False):
    113105        # Cache the child's output locally so it can be used for error reports.
    114106        child_out_file = StringIO.StringIO()
     
    124116        child_output = child_out_file.getvalue()
    125117        child_out_file.close()
    126 
    127         # We assume the child process output utf-8
    128         if decode_output:
    129             child_output = child_output.decode("utf-8")
    130118
    131119        if exit_code:
     
    158146            # using Cygwin, it worked fine.  We should investigate whether
    159147            # we need this platform specific code here.
    160             subprocess.call(('taskkill.exe', '/f', '/pid', unicode(pid)),
     148            subprocess.call(('taskkill.exe', '/f', '/pid', str(pid)),
    161149                            stdin=open(os.devnull, 'r'),
    162150                            stdout=subprocess.PIPE,
     
    176164        pass
    177165
    178     def _compute_stdin(self, input):
    179         """Returns (stdin, string_to_communicate)"""
    180         if not input:
    181             return (None, None)
    182         if hasattr(input, "read"):  # Check if the input is a file.
    183             return (input, None)  # Assume the file is in the right encoding.
    184 
    185         # Popen in Python 2.5 and before does not automatically encode unicode objects.
    186         # http://bugs.python.org/issue5290
    187         # See https://bugs.webkit.org/show_bug.cgi?id=37528
    188         # for an example of a regresion caused by passing a unicode string directly.
    189         # FIXME: We may need to encode differently on different platforms.
    190         if isinstance(input, unicode):
    191             input = input.encode("utf-8")
    192         return (subprocess.PIPE, input)
    193 
    194     # FIXME: run_and_throw_if_fail should be merged into this method.
     166    # FIXME: This should be merged with run_and_throw_if_fail
     167
    195168    def run_command(self,
    196169                    args,
     
    199172                    error_handler=None,
    200173                    return_exit_code=False,
    201                     return_stderr=True,
    202                     decode_output=True):
    203         args = map(unicode, args)  # Popen will throw an exception if args are non-strings (like int())
    204         stdin, string_to_communicate = self._compute_stdin(input)
    205         stderr = subprocess.STDOUT if return_stderr else None
     174                    return_stderr=True):
     175        if hasattr(input, 'read'): # Check if the input is a file.
     176            stdin = input
     177            string_to_communicate = None
     178        else:
     179            stdin = None
     180            if input:
     181                stdin = subprocess.PIPE
     182            # string_to_communicate seems to need to be a str for proper
     183            # communication with shell commands.
     184            # See https://bugs.webkit.org/show_bug.cgi?id=37528
     185            # For an example of a regresion caused by passing a unicode string through.
     186            string_to_communicate = str(input)
     187        if return_stderr:
     188            stderr = subprocess.STDOUT
     189        else:
     190            stderr = None
    206191
    207192        process = subprocess.Popen(args,
     
    211196                                   cwd=cwd)
    212197        output = process.communicate(string_to_communicate)[0]
    213         # run_command automatically decodes to unicode() unless explicitly told not to.
    214         if decode_output:
    215             output = output.decode("utf-8")
    216198        exit_code = process.wait()
    217199
  • trunk/WebKitTools/Scripts/webkitpy/common/system/executive_unittest.py

    r57907 r57920  
    1 # Copyright (C) 2010 Google Inc. All rights reserved.
     1# Copyright (C) 2009 Google Inc. All rights reserved.
    22# Copyright (C) 2009 Daniel Bates (dbates@intudata.com). All rights reserved.
    33#
     
    3232from webkitpy.common.system.executive import Executive, run_command
    3333
    34 
    3534class ExecutiveTest(unittest.TestCase):
    3635
     
    4039        self.failUnlessRaises(OSError, run_bad_command)
    4140
    42     def test_run_command_with_unicode(self):
    43         """Validate that it is safe to pass unicode() objects
    44         to Executive.run* methods, and they will return unicode()
    45         objects by default unless decode_output=False"""
    46         executive = Executive()
    47         unicode_tor = u"WebKit \u2661 Tor Arne Vestb\u00F8!"
    48         utf8_tor = unicode_tor.encode("utf-8")
    49 
    50         output = executive.run_command(["cat"], input=unicode_tor)
    51         self.assertEquals(output, unicode_tor)
    52 
    53         output = executive.run_command(["echo", "-n", unicode_tor])
    54         self.assertEquals(output, unicode_tor)
    55 
    56         output = executive.run_command(["echo", "-n", unicode_tor], decode_output=False)
    57         self.assertEquals(output, utf8_tor)
    58 
    59         # FIXME: We should only have one run* method to test
    60         output = executive.run_and_throw_if_fail(["echo", "-n", unicode_tor], quiet=True)
    61         self.assertEquals(output, unicode_tor)
    62 
    63         output = executive.run_and_throw_if_fail(["echo", "-n", unicode_tor], quiet=True, decode_output=False)
    64         self.assertEquals(output, utf8_tor)
     41if __name__ == '__main__':
     42    unittest.main()
  • trunk/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py

    r57907 r57920  
    3636"""
    3737
    38 import codecs
    3938import copy
    4039import logging
     
    288287        tests_run_filename = os.path.join(self._options.results_directory,
    289288                                          "tests_run.txt")
    290         tests_run_file = codecs.open(tests_run_filename, "a", "utf-8")
     289        tests_run_file = open(tests_run_filename, "a")
    291290
    292291        while True:
  • trunk/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py

    r57907 r57920  
    2828# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2929
    30 import codecs
    3130import logging
    3231import os
     
    120119        json = self._get_json()
    121120        if json:
    122             results_file = codecs.open(self._results_file_path, "w", "utf-8")
     121            results_file = open(self._results_file_path, "w")
    123122            results_file.write(json)
    124123            results_file.close()
  • trunk/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/metered_stream.py

    r57907 r57920  
    6161        self._last_update = ""
    6262
    63     # FIXME: Does this take a string (unicode) or an array of bytes (str)?
    64     # If it takes a string, it needs to call txt.encode("utf-8")
    6563    def write(self, txt):
    6664        """Write to the stream, overwriting and resetting the meter."""
     
    8987        self._write(str)
    9088
    91     # FIXME: Does this take a string (unicode) or an array of bytes (str)?
    92     # If it takes a string, it needs to call txt.encode("utf-8")
    9389    def update(self, str):
    9490        """
  • trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/mac_unittest.py

    r57907 r57920  
    4141        self.assertEqual(relative_paths, ['LayoutTests/platform/mac-leopard/Skipped', 'LayoutTests/platform/mac/Skipped'])
    4242
    43     example_skipped_file = u"""
     43    example_skipped_file = """
    4444# <rdar://problem/5647952> fast/events/mouseout-on-window.html needs mac DRT to issue mouse out events
    4545fast/events/mouseout-on-window.html
     
    5959    def test_skipped_file_paths(self):
    6060        port = mac.MacPort()
    61         skipped_file = StringIO.StringIO(self.example_skipped_file.encode("utf-8"))
     61        skipped_file = StringIO.StringIO(self.example_skipped_file)
    6262        self.assertEqual(port._tests_from_skipped_file(skipped_file), self.example_skipped_tests)
    6363
  • trunk/WebKitTools/Scripts/webkitpy/tool/commands/earlywarningsystem.py

    r57907 r57920  
    2626# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     28
     29from StringIO import StringIO
    2830
    2931from webkitpy.tool.commands.queues import AbstractReviewQueue
  • trunk/WebKitTools/Scripts/webkitpy/tool/commands/queues.py

    r57907 r57920  
    7272        webkit_patch_args = [self.tool.path()]
    7373        # FIXME: This is a hack, we should have a more general way to pass global options.
    74         webkit_patch_args.append("--status-host")
    75         webkit_patch_args.append(self.tool.status_server.host)
    76         webkit_patch_args.extend(args)
     74        webkit_patch_args += ["--status-host=%s" % self.tool.status_server.host]
     75        webkit_patch_args += map(str, args)
    7776        return self.tool.executive.run_and_throw_if_fail(webkit_patch_args)
    7877
     
    125124            message = "Error: %s" % message
    126125        output = script_error.message_with_output(output_limit=1024*1024) # 1MB
    127         return tool.status_server.update_status(cls.name, message, state["patch"], StringIO(output.encode("utf-8")))
     126        return tool.status_server.update_status(cls.name, message, state["patch"], StringIO(output))
    128127
    129128
  • trunk/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py

    r57907 r57920  
    7676
    7777        queue.run_webkit_patch(run_args)
    78         expected_run_args = ["echo", "--status-host", "example.com"] + run_args
     78        expected_run_args = ["echo", "--status-host=example.com"] + map(str, run_args)
    7979        tool.executive.run_and_throw_if_fail.assert_called_with(expected_run_args)
    8080
     
    1511511 patch in commit-queue [106]
    152152""",
    153             "process_work_item": "MOCK run_and_throw_if_fail: ['echo', '--status-host', 'example.com', 'land-attachment', '--force-clean', '--build', '--test', '--non-interactive', '--ignore-builders', '--build-style=both', '--quiet', 76543]\n",
     153            "process_work_item": "MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'land-attachment', '--force-clean', '--build', '--test', '--non-interactive', '--ignore-builders', '--build-style=both', '--quiet', '76543']\n",
    154154        }
    155155        self.assert_queue_outputs(CommitQueue(), tool=tool, work_item=rollout_patch, expected_stderr=expected_stderr)
  • trunk/WebKitTools/Scripts/webkitpy/tool/commands/upload.py

    r57907 r57920  
    3131import os
    3232import re
     33import StringIO
    3334import sys
    3435
     
    260261        return comment_text
    261262
     263    def _diff_file_for_commit(self, tool, commit_id):
     264        diff = tool.scm().create_patch_from_local_commit(commit_id)
     265        return StringIO.StringIO(diff) # add_patch_to_bug expects a file-like object
     266
    262267    def execute(self, options, args, tool):
    263268        commit_ids = tool.scm().commit_ids_from_commitish_arguments(args)
     
    280285                have_obsoleted_patches.add(bug_id)
    281286
    282             diff = tool.scm().create_patch_from_local_commit(commit_id)
     287            diff_file = self._diff_file_for_commit(tool, commit_id)
    283288            description = options.description or commit_message.description(lstrip=True, strip_url=True)
    284289            comment_text = self._comment_text_for_commit(options, commit_message, tool, commit_id)
    285             tool.bugs.add_patch_to_bug(bug_id, diff, description, comment_text, mark_for_review=options.review, mark_for_commit_queue=options.request_commit)
     290            tool.bugs.add_patch_to_bug(bug_id, diff_file, description, comment_text, mark_for_review=options.review, mark_for_commit_queue=options.request_commit)
    286291
    287292
     
    400405
    401406        diff = tool.scm().create_patch_from_local_commit(commit_id)
    402         bug_id = tool.bugs.create_bug(bug_title, comment_text, options.component, diff, "Patch", cc=options.cc, mark_for_review=options.review, mark_for_commit_queue=options.request_commit)
     407        diff_file = StringIO.StringIO(diff) # create_bug expects a file-like object
     408        bug_id = tool.bugs.create_bug(bug_title, comment_text, options.component, diff_file, "Patch", cc=options.cc, mark_for_review=options.review, mark_for_commit_queue=options.request_commit)
    403409
    404410        if bug_id and len(commit_ids) > 1:
     
    419425
    420426        diff = tool.scm().create_patch()
    421         bug_id = tool.bugs.create_bug(bug_title, comment_text, options.component, diff, "Patch", cc=options.cc, mark_for_review=options.review, mark_for_commit_queue=options.request_commit)
     427        diff_file = StringIO.StringIO(diff) # create_bug expects a file-like object
     428        bug_id = tool.bugs.create_bug(bug_title, comment_text, options.component, diff_file, "Patch", cc=options.cc, mark_for_review=options.review, mark_for_commit_queue=options.request_commit)
    422429
    423430    def prompt_for_bug_title_and_comment(self):
  • trunk/WebKitTools/Scripts/webkitpy/tool/mocktool.py

    r57907 r57920  
    261261                   bug_description,
    262262                   component=None,
    263                    diff=None,
     263                   patch_file_object=None,
    264264                   patch_description=None,
    265265                   cc=None,
     
    300300    def add_patch_to_bug(self,
    301301                         bug_id,
    302                          diff,
     302                         patch_file_object,
    303303                         description,
    304304                         comment_text=None,
  • trunk/WebKitTools/Scripts/webkitpy/tool/steps/abstractstep.py

    r57907 r57920  
    4040        log("Running %s" % script_name)
    4141        # FIXME: This should use self.port()
    42         self._tool.executive.run_and_throw_if_fail([port.script_path(script_name)], quiet)
     42        self._tool.executive.run_and_throw_if_fail(port.script_path(script_name), quiet)
    4343
    4444    # FIXME: The port should live on the tool.
  • trunk/WebKitTools/Scripts/webkitpy/tool/steps/postdiff.py

    r57907 r57920  
    2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828
     29import StringIO
     30
    2931from webkitpy.tool.steps.abstractstep import AbstractStep
    3032from webkitpy.tool.steps.options import Options
     
    4345    def run(self, state):
    4446        diff = self.cached_lookup(state, "diff")
     47        diff_file = StringIO.StringIO(diff) # add_patch_to_bug expects a file-like object
    4548        description = self._options.description or "Patch"
    4649        comment_text = None
     
    5053        if codereview_issue:
    5154            description += "-%s" % state["codereview_issue"]
    52         self._tool.bugs.add_patch_to_bug(state["bug_id"], diff, description, comment_text=comment_text, mark_for_review=self._options.review, mark_for_commit_queue=self._options.request_commit)
     55        self._tool.bugs.add_patch_to_bug(state["bug_id"], diff_file, description, comment_text=comment_text, mark_for_review=self._options.review, mark_for_commit_queue=self._options.request_commit)
    5356        if self._options.open_bug:
    5457            self._tool.user.open_url(self._tool.bugs.bug_url_for_bug_id(state["bug_id"]))
  • trunk/WebKitTools/Scripts/webkitpy/tool/steps/postdiffforcommit.py

    r57907 r57920  
    2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828
     29import StringIO
     30
    2931from webkitpy.tool.steps.abstractstep import AbstractStep
    3032
     
    3436        self._tool.bugs.add_patch_to_bug(
    3537            state["bug_id"],
    36             self.cached_lookup(state, "diff"),
     38            StringIO.StringIO(self.cached_lookup(state, "diff")),
    3739            "Patch for landing",
    3840            mark_for_review=False,
  • trunk/WebKitTools/Scripts/webkitpy/tool/steps/postdiffforrevert.py

    r57907 r57920  
    2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828
     29import StringIO
     30
    2931from webkitpy.common.net.bugzilla import Attachment
    3032from webkitpy.tool.steps.abstractstep import AbstractStep
     
    4345        self._tool.bugs.add_patch_to_bug(
    4446            state["bug_id"],
    45             self.cached_lookup(state, "diff"),
     47            StringIO.StringIO(self.cached_lookup(state, "diff")),
    4648            "%s%s" % (Attachment.rollout_preamble, state["revision"]),
    4749            comment_text=comment_text,
  • trunk/WebKitTools/Scripts/webkitpy/tool/steps/steps_unittest.py

    r57907 r57920  
    4949        options = Mock()
    5050        options.update = True
    51         expected_stderr = "Updating working directory\n"
    52         OutputCapture().assert_outputs(self, self._run_step, [Update, options], expected_stderr=expected_stderr)
     51        self._run_step(Update, options)
    5352
    5453    def test_prompt_for_bug_or_title_step(self):
Note: See TracChangeset for help on using the changeset viewer.