зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1462701 [wpt PR 11072] - Merge w3ctestlib into web-platform-tests, a=testonly
Automatic update from web-platform-testsMerge pull request #11072 from gsnedders/merge-w3ctestlib Merge w3ctestlib and apiclient into web-platform-tests as subtrees -- wpt-commits: 1c7d7b815b29f08856205ab6e426c0e496ca0ef0 wpt-pr: 11072
This commit is contained in:
Родитель
bb5a99093f
Коммит
7e120afe76
|
@ -1,9 +1,3 @@
|
|||
[submodule "css/tools/apiclient"]
|
||||
path = css/tools/apiclient
|
||||
url = https://github.com/w3c/csswg-apiclient.git
|
||||
[submodule "css/tools/w3ctestlib"]
|
||||
path = css/tools/w3ctestlib
|
||||
url = https://github.com/w3c/csswg-w3ctestlib.git
|
||||
[submodule "tools/html5lib/html5lib/tests/testdata"]
|
||||
path = tools/html5lib/html5lib/tests/testdata
|
||||
url = https://github.com/html5lib/html5lib-tests.git
|
||||
|
|
|
@ -41,12 +41,6 @@ main() {
|
|||
# Install dependencies
|
||||
$VENV/bin/pip install -r requirements.txt
|
||||
|
||||
# Error if submodules are not there
|
||||
if [ ! -d tools/apiclient -o ! -d tools/w3ctestlib ]; then
|
||||
echo 'Please run `git submodule update --init --recursive`'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run the build script
|
||||
$VENV/bin/python tools/build.py "$@"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
This directory contains the CSS build system.
|
||||
|
||||
It is recommended that it is run with `../build-css-testsuites.sh`, as
|
||||
this ensures all dependencies are installed. Note that it is not
|
||||
required to build the testsuites to run tests; you can just run tests
|
||||
as with any other web-platform-tests tests (see ../../docs/).
|
||||
|
||||
The build system is formed of build.py in this directory, the
|
||||
w3ctestlib package in w3ctestlib/, and the apiclient package in
|
||||
apiclient/apiclient/. Note that apiclient exists as a separate
|
||||
upstream project at https://hg.csswg.org/dev/apiclient/, and that
|
||||
ideally any changes here should make it upstream.
|
|
@ -1,77 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# This file is licensed under CC Zero
|
||||
|
||||
import sys
|
||||
import html5lib
|
||||
import re
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print """! html2xhtml requires two arguments: the filename to read, and the filename to write"""
|
||||
exit()
|
||||
|
||||
#######################################################################
|
||||
# Parse HTML and output XHTML
|
||||
|
||||
f = open(sys.argv[1])
|
||||
p = html5lib.HTMLParser()
|
||||
t = p.parse(f)
|
||||
o = html5lib.serializer.serialize(t, format='xhtml')
|
||||
f.close()
|
||||
|
||||
#######################################################################
|
||||
# Clean up the mess left by html5lib
|
||||
|
||||
def firstMatch(m): # Python makes s/x(y+)?/z$1/ very difficult
|
||||
if m.group(1):
|
||||
return m.group(1)
|
||||
return ''
|
||||
|
||||
# Missing XHTML artifacts
|
||||
|
||||
o = re.sub('<!DOCTYPE [^>]+>',
|
||||
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
|
||||
o);
|
||||
o = re.sub('<html( [^>]+)?>',
|
||||
lambda m : '<html' + firstMatch(m) + ' xmlns="http://www.w3.org/1999/xhtml">',
|
||||
o);
|
||||
|
||||
# Fix weird reordering
|
||||
|
||||
o = re.sub('<link href="(.*?)" (.*?) ?/>',
|
||||
lambda m : '<link ' + m.group(2) + ' href="' + m.group(1) + '"/>',
|
||||
o);
|
||||
|
||||
# Indentation
|
||||
|
||||
o = re.sub('<!DOCTYPE ([^>]+)><html',
|
||||
lambda m : '<!DOCTYPE ' + firstMatch(m) + '>\n<html',
|
||||
o);
|
||||
o = re.sub('<html( [^>]+)?><',
|
||||
lambda m : '<html' + firstMatch(m) + '>\n<',
|
||||
o);
|
||||
o = re.sub('<head( [^>]+)?><',
|
||||
lambda m : '<head' + firstMatch(m) + '>\n<',
|
||||
o);
|
||||
o = re.sub('</head><',
|
||||
'</head>\n<',
|
||||
o);
|
||||
o = re.sub('<body( [^>]+)?><',
|
||||
lambda m : '<body' + firstMatch(m) + '>\n<',
|
||||
o);
|
||||
o = re.sub('</body><',
|
||||
'</body>\n<',
|
||||
o);
|
||||
o = re.sub('</html>$',
|
||||
'</html>\n',
|
||||
o);
|
||||
o = re.sub('\xa0',
|
||||
' ',
|
||||
o); # make nbsp visible to people viewing source
|
||||
|
||||
#######################################################################
|
||||
# Write to file
|
||||
|
||||
f = open(sys.argv[2], 'w')
|
||||
f.write(o.encode('utf-8'))
|
||||
f.close()
|
|
@ -1,86 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
# Print all files by filename and highlight duplicates
|
||||
# Prints in format specified as an argument on the command line:
|
||||
# '-txt' -> tab-separated database
|
||||
# '-pre' -> linkified tab-separated database using HTML and <pre>
|
||||
# '-html' -> HTML with tables
|
||||
|
||||
use Template;
|
||||
|
||||
$top = $ARGV[-1] || '.';
|
||||
|
||||
@files = `find $top -type f ! -ipath '*.hg*' ! -ipath '*build-test*' ! -ipath '*selectors3*'`;
|
||||
foreach (@files) {
|
||||
chomp;
|
||||
m!^(?:\./)?((?:[^/]+/)*)([^/]+?)(\.[a-z]+)?$!;
|
||||
next if (m!/support/!);
|
||||
next if (m!\.css$!);
|
||||
next if (m!boland!);
|
||||
unless (exists $pairs{$2}) {
|
||||
$pairs{$2} = ["$1$2$3"];
|
||||
}
|
||||
else {
|
||||
push @{$pairs{$2}}, "$1$2$3";
|
||||
}
|
||||
}
|
||||
|
||||
my $tt = Template->new({ INCLUDE_PATH => $libroot . '/templates' }) || die $tt->error(), "\n";
|
||||
|
||||
# default template
|
||||
$tmpl = <<'EOM'
|
||||
[%- FOREACH name = pairs.keys.sort %]
|
||||
[%- FOREACH path = pairs.$name %]
|
||||
[% name %] [% path %]
|
||||
[%- END %][% END %]
|
||||
EOM
|
||||
;
|
||||
# linkified version
|
||||
if ($ARGV[0] eq '-pre') {
|
||||
$tmpl = <<'EOM'
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<title>CSS Tests by Filename</title>
|
||||
<pre> <!-- tables are too slow -->
|
||||
[%- FOREACH name = pairs.keys.sort %]
|
||||
[%- FOREACH path = pairs.$name %]
|
||||
[% name %] <a href="[% path %]">[% path %]</a>
|
||||
[%- END %][% END %]
|
||||
</pre>
|
||||
EOM
|
||||
}
|
||||
# tables version
|
||||
elsif ($ARGV[0] eq '-html') {
|
||||
$tmpl = <<'EOM'
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<title>CSS Tests by Filename</title>
|
||||
<style type="text/css">
|
||||
table { table-layout: fixed; }
|
||||
.dup { background: yellow; }
|
||||
th, td { text-align: left; }
|
||||
</style>
|
||||
<body>
|
||||
|
||||
<h1>CSS Tests by Filename</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th>Filename <th>Path</tr>
|
||||
</thead>
|
||||
[%- FOREACH pair = pairs.pairs %]
|
||||
<tbody>
|
||||
[%- first = 1 %]
|
||||
[%- FOREACH path = pair.value %]
|
||||
<tr[%' class="support"' IF path.match('support') %]>
|
||||
[%- IF first %]
|
||||
<th rowspan="[% pair.value.size %]">[% pair.key %]
|
||||
[%- END %]
|
||||
<td><a href="[% path %]">[% path %]</a>
|
||||
[%- first = 0 %]
|
||||
[%- END %]
|
||||
</tbody>
|
||||
[%- END %]
|
||||
</table>
|
||||
EOM
|
||||
}
|
||||
|
||||
$tt->process(\$tmpl, { 'pairs' => \%pairs });
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/bash
|
||||
# First arg is directory path to list, second arg is path to output file (minus file extension)
|
||||
find $1 -type f ! -ipath '*.hg*' ! -ipath '*build-test*' ! -ipath '*selectors3*' ! -ipath '*/support/*' ! -ipath '*boland*' ! -ipath '*incoming*' > $2.txt
|
||||
perl -pi -e "s#^$1/?((?:[^/]+/)*)([^/]+?)(\.[a-z]+)?\$#\$2\t\$1\$2\$3#" $2.txt
|
||||
sort $2.txt -o $2.txt
|
||||
echo '<!DOCTYPE html><html><title>CSS Tests by Filename</title><pre>' > $2.html
|
||||
perl -pe 's#\t(.+)$#\t<a href="$1">$1</a>#' < $2.txt >> $2.html
|
||||
echo '</pre>' >> $2.html
|
|
@ -1,66 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# HTMLMake
|
||||
# Converts all files of specified extension from XHTML to HTML
|
||||
# Written by fantasai
|
||||
# Joint copyright 2010 W3C and Microsoft
|
||||
# Licensed under BSD 3-Clause: <http://www.w3.org/Consortium/Legal/2008/03-bsd-license>
|
||||
|
||||
srcExt = '.xht'
|
||||
dstExt = '.htm'
|
||||
skipDirs = ('contributors/microsoft/submitted/support', # XXXfixme files should be .xht
|
||||
'incoming', '.svn', 'CVS', '.hg')
|
||||
|
||||
import os.path
|
||||
from os.path import join, getmtime
|
||||
import sys
|
||||
import re
|
||||
import os
|
||||
from w3ctestlib.Sources import XHTMLSource, SourceTree
|
||||
|
||||
def xhtml2html(source, dest):
|
||||
"""Convert XHTML file given by path `source` into HTML file at path `dest`."""
|
||||
|
||||
# Parse and serialize
|
||||
xs = XHTMLSource(SourceTree(None), source, dest)
|
||||
o = xs.serializeHTML()
|
||||
|
||||
# Report errors
|
||||
if xs.error:
|
||||
print >>sys.stderr, "Error parsing XHTML file %s: %s" % (source, xs.error)
|
||||
|
||||
# Write
|
||||
f = open(dest, 'w')
|
||||
f.write(o.encode(xs.encoding, 'xmlcharrefreplace'))
|
||||
f.close()
|
||||
|
||||
if len(sys.argv) == 3:
|
||||
clobber = sys.argv[1] == '--clobber'
|
||||
force = sys.argv[1] == '-f'
|
||||
root = sys.argv[2]
|
||||
elif len(sys.argv) == 2 and (sys.argv[1] != '--clobber' and sys.argv[1] != '-f'):
|
||||
clobber = False;
|
||||
force = False;
|
||||
root = sys.argv[1]
|
||||
else:
|
||||
print "make-html converts all %s XHTML files to %s HTML files." % (srcExt, dstExt)
|
||||
print "Only changed files are converted, unless you specify -f."
|
||||
print "To use, specify the root directory of the files you want converted, e.g."
|
||||
print " make-html ."
|
||||
print "To delete all files with extension %s, specify the --clobber option." % dstExt
|
||||
exit()
|
||||
|
||||
for root, dirs, files in os.walk(root):
|
||||
for skip in skipDirs:
|
||||
if skip in dirs:
|
||||
dirs.remove(skip)
|
||||
for file in files:
|
||||
if clobber:
|
||||
if file.endswith(dstExt):
|
||||
os.remove(join(root, file))
|
||||
elif file.endswith(srcExt):
|
||||
source = join(root, file)
|
||||
dest = join(root, file[0:-1*len(srcExt)] + dstExt)
|
||||
if not os.path.exists(dest) or getmtime(source) > getmtime(dest) or force:
|
||||
# print "Processing %s" % source
|
||||
xhtml2html(source, dest)
|
|
@ -1,156 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# This file is licensed under CC Zero
|
||||
|
||||
import os
|
||||
from os.path import join
|
||||
import shutil
|
||||
import filecmp
|
||||
|
||||
# Files to not sync across support/ directories
|
||||
fileExcludes = ('README')
|
||||
dirExcludes = ('.svn', '.hg', 'CVS')
|
||||
# To prevent support files from being propagated into a particular support/
|
||||
# directory, add a file named LOCK
|
||||
|
||||
def propagate(source, dest, errors):
|
||||
"""Compare each file and copy from source to destination.
|
||||
Do nothing and flag an error if the destination already exists
|
||||
but is different. Recurse.
|
||||
source and dest are both directory paths.
|
||||
errors is a list of 2-element tuples, the first being a
|
||||
source filepath and the second a destination filepath,
|
||||
of file pairs where the destination isdifferent from
|
||||
"""
|
||||
|
||||
# This directory is locked; don't propagate
|
||||
if os.path.exists(join(dest, 'LOCK')): return
|
||||
|
||||
# If the source directory doesn't exist return
|
||||
if not os.path.exists(source): return
|
||||
|
||||
# Get the file and directory lists for source
|
||||
children = os.listdir(source)
|
||||
for name in children:
|
||||
origin = join(source, name)
|
||||
copy = join(dest, name)
|
||||
if os.path.isfile(origin):
|
||||
if name in fileExcludes: continue
|
||||
# Copy over the file if it needs copying
|
||||
if not os.path.exists(copy): # file missing
|
||||
shutil.copy2(origin, copy) # copy it over
|
||||
elif not filecmp.cmp(origin, copy): # files differ
|
||||
if not filecmp.cmp(origin, copy, True): # contents equal, stats differ
|
||||
shutil.copystat(origin, copy) # update stats so they match for next time
|
||||
else: # contents differ
|
||||
errors.append((origin, copy))
|
||||
elif os.path.isdir(origin):
|
||||
if name in dirExcludes: continue
|
||||
# Duplicate the directory structure and propagate the subtree
|
||||
if not os.path.exists(copy):
|
||||
os.makedirs(copy)
|
||||
propagate(origin, copy, errors)
|
||||
if len(children) == 0:
|
||||
print "Warn: " + source + " is empty.\n"
|
||||
|
||||
def waterfall(parentDir, childDir, errors):
|
||||
"""Copy down support files from parent support to child.
|
||||
parentDir is the parent of the parent support directory.
|
||||
childDir is the parent of the current support directory,
|
||||
that we should copy into.
|
||||
waterfall recurses into childDir's children."""
|
||||
assert os.path.exists(join(parentDir, 'support')), join(parentDir, 'support') + " doesn't exist\n"
|
||||
if os.path.exists(join(childDir, 'support')):
|
||||
propagate(join(parentDir, 'support'), join(childDir, 'support'), errors)
|
||||
dirs = os.walk(childDir).next()[1]
|
||||
for name in dirs:
|
||||
if name == 'support':
|
||||
pass
|
||||
elif name not in dirExcludes:
|
||||
waterfall(childDir, join(childDir, name), errors)
|
||||
|
||||
def outline(source, dest, errors):
|
||||
"""Copy over directory structure and all files under any support/ directories
|
||||
source and dest are both directory paths.
|
||||
errors is a list of 2-element tuples, the first being a
|
||||
source filepath and the second a destination filepath,
|
||||
of support file pairs where the destination copy is
|
||||
different from the source
|
||||
"""
|
||||
# Get the directory list for source
|
||||
dirs = os.walk(source).next()[1]
|
||||
# Copy directory structure
|
||||
for name in dirs:
|
||||
if name in dirExcludes: continue
|
||||
origin = join(source, name)
|
||||
copy = join(dest, name)
|
||||
if not os.path.exists(copy):
|
||||
os.mkdirs(copy)
|
||||
if name == 'support':
|
||||
# Copy support files
|
||||
propagate(origin, copy, errors)
|
||||
else:
|
||||
outline(origin, copy, errors)
|
||||
|
||||
def syncSupport(source, dest, errors):
|
||||
"""For each support directory in dest, propagate the corresponding support
|
||||
files from source.
|
||||
source and dest are both directory paths.
|
||||
errors is a list of 2-element tuples, the first being a
|
||||
source filepath and the second a destination filepath,
|
||||
of support file pairs where the destination copy is
|
||||
different from the source
|
||||
"""
|
||||
# Get the directory list for est
|
||||
dirs = os.walk(dest).next()[1]
|
||||
# Scan directory structure, building support dirs as necessary
|
||||
for name in dirs:
|
||||
if name in dirExcludes: continue
|
||||
master = join(source, name)
|
||||
slave = join(dest, name)
|
||||
if name == 'support':
|
||||
# Copy support files
|
||||
propagate(master, slave, errors)
|
||||
else:
|
||||
syncSupport(master, slave, errors)
|
||||
|
||||
def main():
|
||||
# Part I: Propagate support files through approved/
|
||||
|
||||
errors = []
|
||||
root, dirs, _ = os.walk('.').next()
|
||||
if 'approved' in dirs:
|
||||
root = join(root, 'approved')
|
||||
suites = os.walk(root).next()[1]
|
||||
suites = filter(lambda name: name not in dirExcludes, suites)
|
||||
for suite in suites:
|
||||
waterfall(root, join(root, suite, 'src'), errors)
|
||||
else:
|
||||
print "Failed to find approved/ directory.\n"
|
||||
exit();
|
||||
|
||||
# Part II: Propagate test suite support files into contributors/
|
||||
|
||||
if 'contributors' in dirs:
|
||||
_, contribs, _ = os.walk('contributors').next()
|
||||
for contributor in contribs:
|
||||
contribRoot = join('contributors', contributor, 'submitted')
|
||||
if not os.path.exists(contribRoot): continue # missing submitted folder
|
||||
dirs = os.walk(contribRoot).next()[1]
|
||||
for dir in dirs:
|
||||
# Check if contributor has a top-level directory name matching
|
||||
# one of our suites; if so, sync any matching support directories
|
||||
if dir in suites:
|
||||
suiteRoot = join(root, dir, 'src')
|
||||
if os.path.exists(suiteRoot):
|
||||
syncSupport(suiteRoot, join(contribRoot, dir), errors)
|
||||
else:
|
||||
print "Failed to find contributors/ directory.\n"
|
||||
|
||||
# Print all errors
|
||||
|
||||
for error in errors:
|
||||
print "Mismatch: " + error[0] + " vs " + error [1] + " Copy failed.\n"
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -1,18 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<title>CSS Tests by Filename</title>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>CSS Tests by Filename</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th>Filename <th>Path</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
[% FOREACH pair = pairs.sort %][% parts = pair.split('\t') %]
|
||||
<tr><th>[% parts.0 %] <td><a href="[% parts.1 %]">[% parts.1 %]</a>
|
||||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
|
@ -1,12 +0,0 @@
|
|||
Copyright (c) 2015, Mozilla
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -1,223 +0,0 @@
|
|||
import itertools
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import vcs
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
source_dir = os.path.join(here, "..", "..")
|
||||
|
||||
remote_built = "https://github.com/jgraham/css-test-built.git"
|
||||
built_dir = os.path.join(here, "css-test-built")
|
||||
|
||||
local_files = ["manifest", "serve", "serve.py", ".gitmodules", "tools", "resources",
|
||||
"config.default.json"]
|
||||
|
||||
def get_hgsubstate():
|
||||
state = {}
|
||||
with open(os.path.join(source_dir, ".hgsubstate"), "r") as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
revision, path = line.split(" ", 1)
|
||||
state[path] = revision
|
||||
return state
|
||||
|
||||
def fetch_submodules():
|
||||
hg = vcs.hg
|
||||
orig_dir = os.getcwd()
|
||||
state = get_hgsubstate()
|
||||
for tool in ["apiclient", "w3ctestlib"]:
|
||||
dest_dir = os.path.join(source_dir, "tools", tool)
|
||||
repo_path = "tools/" + tool
|
||||
if os.path.exists(os.path.join(dest_dir, ".hg")):
|
||||
try:
|
||||
os.chdir(dest_dir)
|
||||
if repo_path in state:
|
||||
rev = state[repo_path]
|
||||
try:
|
||||
hg("update", rev, log_error=False)
|
||||
except subprocess.CalledProcessError:
|
||||
hg("pull")
|
||||
hg("update", rev)
|
||||
else:
|
||||
hg("pull")
|
||||
hg("update")
|
||||
finally:
|
||||
os.chdir(orig_dir)
|
||||
else:
|
||||
hg("clone", ("https://hg.csswg.org/dev/%s" % tool), dest_dir)
|
||||
try:
|
||||
os.chdir(dest_dir)
|
||||
if repo_path in state:
|
||||
hg("update", state[repo_path])
|
||||
else:
|
||||
hg("update")
|
||||
finally:
|
||||
os.chdir(orig_dir)
|
||||
|
||||
def update_dist():
|
||||
if not os.path.exists(built_dir) or not vcs.is_git_root(built_dir):
|
||||
git = vcs.git
|
||||
git("clone", "--depth", "1", remote_built, built_dir)
|
||||
else:
|
||||
git = vcs.bind_to_repo(vcs.git, built_dir)
|
||||
git("fetch")
|
||||
if "origin/master" in git("branch", "-a"):
|
||||
git("checkout", "master")
|
||||
git("merge", "--ff-only", "origin/master")
|
||||
|
||||
git = vcs.bind_to_repo(vcs.git, built_dir)
|
||||
git("config", "user.email", "CssBuildBot@users.noreply.github.com")
|
||||
git("config", "user.name", "CSS Build Bot")
|
||||
git("submodule", "update", "--init", "--recursive")
|
||||
|
||||
def setup_virtualenv():
|
||||
virtualenv_path = os.path.join(here, "_virtualenv")
|
||||
|
||||
if not os.path.exists(virtualenv_path):
|
||||
subprocess.check_call(["virtualenv", virtualenv_path])
|
||||
|
||||
activate_path = os.path.join(virtualenv_path, "bin", "activate_this.py")
|
||||
|
||||
execfile(activate_path, dict(__file__=activate_path))
|
||||
|
||||
subprocess.check_call(["pip", "-q", "install", "mercurial"])
|
||||
subprocess.check_call(["pip", "-q", "install", "html5lib==0.9999999"])
|
||||
subprocess.check_call(["pip", "-q", "install", "lxml"])
|
||||
subprocess.check_call(["pip", "-q", "install", "Template-Python"])
|
||||
|
||||
|
||||
def update_to_changeset(changeset):
|
||||
git = vcs.bind_to_repo(vcs.git, source_dir)
|
||||
git("checkout", changeset)
|
||||
apply_build_system_fixes()
|
||||
|
||||
def apply_build_system_fixes():
|
||||
fixes = [
|
||||
"c017547f65e07bdd889736524d47824d032ba2e8",
|
||||
"cb4a737a88aa7e2f4e54383c57ffa2dfae093dcf",
|
||||
"ec540343a3e729644c8178dbcf6d063dca20d49f",
|
||||
]
|
||||
git = vcs.bind_to_repo(vcs.git, source_dir)
|
||||
for fix in fixes:
|
||||
git("cherry-pick", "--keep-redundant-commits", fix)
|
||||
|
||||
def build_tests():
|
||||
subprocess.check_call(["python", os.path.join(source_dir, "tools", "build.py")],
|
||||
cwd=source_dir)
|
||||
|
||||
def remove_current_files():
|
||||
for node in os.listdir(built_dir):
|
||||
if node.startswith(".git"):
|
||||
continue
|
||||
|
||||
if node in ("resources", "tools"):
|
||||
continue
|
||||
|
||||
path = os.path.join(built_dir, node)
|
||||
if os.path.isdir(path):
|
||||
shutil.rmtree(path)
|
||||
else:
|
||||
os.remove(path)
|
||||
|
||||
def copy_files():
|
||||
dist_path = os.path.join(source_dir, "dist")
|
||||
for node in os.listdir(dist_path):
|
||||
src_path = os.path.join(dist_path, node)
|
||||
dest_path = os.path.join(built_dir, node)
|
||||
if os.path.isdir(src_path):
|
||||
shutil.copytree(src_path, dest_path)
|
||||
else:
|
||||
shutil.copy2(src_path, dest_path)
|
||||
|
||||
def update_git():
|
||||
git = vcs.bind_to_repo(vcs.git, built_dir)
|
||||
git("add", ".")
|
||||
|
||||
def add_changeset(changeset):
|
||||
git = vcs.bind_to_repo(vcs.git, built_dir)
|
||||
|
||||
dest_path = os.path.join(built_dir, "source_rev")
|
||||
with open(dest_path, "w") as f:
|
||||
f.write(changeset)
|
||||
git("add", os.path.relpath(dest_path, built_dir))
|
||||
|
||||
def commit(changeset):
|
||||
git = vcs.git
|
||||
|
||||
msg = git("log", "-r", changeset, "-n", "1", "--pretty=%B", repo=source_dir)
|
||||
msg = "%s\n\nBuild from revision %s" % (msg, changeset)
|
||||
|
||||
git("commit", "-m", msg, repo=built_dir)
|
||||
|
||||
def get_new_commits():
|
||||
git = vcs.bind_to_repo(vcs.git, source_dir)
|
||||
commit_path = os.path.join(built_dir, "source_rev")
|
||||
with open(commit_path) as f:
|
||||
prev_commit = f.read().strip()
|
||||
|
||||
if git("rev-parse", "--revs-only", prev_commit).strip() != prev_commit:
|
||||
# we don't have prev_commit in current tree, so let's just do what's new
|
||||
commit_range = os.environ['TRAVIS_COMMIT_RANGE']
|
||||
assert (os.environ["TRAVIS_PULL_REQUEST"] != "false" or
|
||||
os.environ["TRAVIS_BRANCH"] != "master")
|
||||
else:
|
||||
merge_base = git("merge-base", prev_commit, os.environ['TRAVIS_COMMIT']).strip()
|
||||
commit_range = "%s..%s" % (merge_base, os.environ['TRAVIS_COMMIT'])
|
||||
|
||||
commits = git("log", "--pretty=%H", "-r", commit_range).strip()
|
||||
if not commits:
|
||||
return []
|
||||
return reversed(commits.split("\n"))
|
||||
|
||||
def maybe_push():
|
||||
if os.environ["TRAVIS_PULL_REQUEST"] != "false":
|
||||
return
|
||||
|
||||
if os.environ["TRAVIS_BRANCH"] != "master":
|
||||
return
|
||||
|
||||
git = vcs.bind_to_repo(vcs.git, built_dir)
|
||||
|
||||
out = "https://%s@github.com/jgraham/css-test-built.git" % os.environ["TOKEN"]
|
||||
git("remote", "add", "out", out, quiet=True)
|
||||
|
||||
for i in range(2):
|
||||
try:
|
||||
git("push", "out", "HEAD:master")
|
||||
except subprocess.CalledProcessError:
|
||||
if i == 0:
|
||||
git("fetch", "origin")
|
||||
git("rebase", "origin/master")
|
||||
else:
|
||||
return
|
||||
|
||||
raise Exception("Push failed")
|
||||
|
||||
def main():
|
||||
setup_virtualenv()
|
||||
fetch_submodules()
|
||||
update_dist()
|
||||
changesets = list(get_new_commits())
|
||||
print >> sys.stderr, "Building %d changesets:" % len(changesets)
|
||||
print >> sys.stderr, "\n".join(changesets)
|
||||
if len(changesets) > 50:
|
||||
raise Exception("Building more than 50 changesets, giving up")
|
||||
|
||||
for changeset in changesets:
|
||||
update_to_changeset(changeset)
|
||||
remove_current_files()
|
||||
build_tests()
|
||||
copy_files()
|
||||
update_git()
|
||||
add_changeset(changeset)
|
||||
commit(changeset)
|
||||
maybe_push()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -1,43 +0,0 @@
|
|||
import subprocess
|
||||
import sys
|
||||
from functools import partial
|
||||
|
||||
def vcs(bin_name):
|
||||
def inner(command, *args, **kwargs):
|
||||
repo = kwargs.pop("repo", None)
|
||||
log_error = kwargs.pop("log_error", True)
|
||||
quiet = kwargs.pop("quiet", False)
|
||||
if kwargs:
|
||||
raise TypeError, kwargs
|
||||
|
||||
args = list(args)
|
||||
|
||||
proc_kwargs = {}
|
||||
if repo is not None:
|
||||
proc_kwargs["cwd"] = repo
|
||||
|
||||
command_line = [bin_name, command] + args
|
||||
if not quiet:
|
||||
print >> sys.stderr, " ".join(command_line[:10])
|
||||
try:
|
||||
return subprocess.check_output(command_line, stderr=subprocess.STDOUT, **proc_kwargs)
|
||||
except subprocess.CalledProcessError as e:
|
||||
if log_error:
|
||||
print >> sys.stderr, e.output
|
||||
raise
|
||||
return inner
|
||||
|
||||
git = vcs("git")
|
||||
hg = vcs("hg")
|
||||
|
||||
|
||||
def bind_to_repo(vcs_func, repo):
|
||||
return partial(vcs_func, repo=repo)
|
||||
|
||||
|
||||
def is_git_root(path):
|
||||
try:
|
||||
rv = git("rev-parse", "--show-cdup", repo=path)
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
return rv == "\n"
|
|
@ -12,7 +12,11 @@ import codecs
|
|||
import collections
|
||||
from xml import dom
|
||||
import html5lib
|
||||
<<<<<<< ours
|
||||
from html5lib import treebuilders, inputstream
|
||||
=======
|
||||
from html5lib import treebuilders
|
||||
>>>>>>> theirs
|
||||
from lxml import etree
|
||||
from lxml.etree import ParseError
|
||||
from Utils import getMimeFromExt, escapeToNamedASCII, basepath, isPathInsideBase, relativeURL, assetName
|
||||
|
@ -1363,10 +1367,15 @@ class HTMLSource(XMLSource):
|
|||
if data:
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore")
|
||||
<<<<<<< ours
|
||||
htmlStream = html5lib.inputstream.HTMLInputStream(data)
|
||||
if ('utf-8-sig' != self.encoding): # if we found a BOM, respect it
|
||||
self.encoding = htmlStream.detectEncoding()[0]
|
||||
self.tree = self.__parser.parse(data, encoding = self.encoding)
|
||||
=======
|
||||
self.tree = self.__parser.parse(data)
|
||||
self.encoding = self.__parser.documentEncoding
|
||||
>>>>>>> theirs
|
||||
self.injectedTags = {}
|
||||
else:
|
||||
self.tree = None
|
||||
|
|
|
@ -40,7 +40,16 @@
|
|||
cover all of [% suites.$suite.spec %]. Your help is welcome in this effort.
|
||||
[% END %]
|
||||
The appropriate mailing list for submitting tests and bug reports is
|
||||
<<<<<<< ours
|
||||
<a href="http://lists.w3.org/Archives/Public/public-css-testsuite/">public-css-testsuite@w3.org</a>.
|
||||
=======
|
||||
<a href="http://lists.w3.org/Archives/Public/public-css-testsuite/">public-css-testsuite@w3.org</a>.</p>
|
||||
<p>
|
||||
To report bugs or feedback about a specific test file,
|
||||
search for the filename (without extension) in
|
||||
<a href="https://github.com/w3c/web-platform-tests/issues">Web Platform Tests Issues</a>,
|
||||
and file a new issue if necessary with suggested label "wg-css".
|
||||
>>>>>>> theirs
|
||||
More information on the contribution process and test guidelines is
|
||||
available on the <a href="http://wiki.csswg.org/test">wiki
|
||||
page</a>.</p>
|
||||
|
@ -187,4 +196,8 @@
|
|||
[% IF suite == 'css2.1' %]
|
||||
<p>...and all the <a href="http://www.w3.org/Style/CSS/Test/CSS1/current/tsack.html">contributors
|
||||
to the CSS1 test suite</a>.</p>
|
||||
[% END %]
|
||||
<<<<<<< ours
|
||||
[% END %]
|
||||
=======
|
||||
[% END %]
|
||||
>>>>>>> theirs
|
||||
|
|
Загрузка…
Ссылка в новой задаче