Fix tidy issues with Python files in python/

This commit is contained in:
Corey Farwell 2015-06-02 19:51:41 -04:00
parent c639a0cf49
commit e3b71c65bf
9 changed files with 106 additions and 18 deletions

View file

@ -66,7 +66,8 @@ CATEGORIES = {
}, },
'disabled': { 'disabled': {
'short': 'Disabled', 'short': 'Disabled',
'long': 'The disabled commands are hidden by default. Use -v to display them. These commands are unavailable for your current context, run "mach <command>" to see why.', 'long': 'The disabled commands are hidden by default. Use -v to display them. These commands are unavailable '
'for your current context, run "mach <command>" to see why.',
'priority': 0, 'priority': 0,
} }
} }

View file

@ -0,0 +1,8 @@
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.

View file

@ -1,3 +1,12 @@
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.
from __future__ import print_function, unicode_literals from __future__ import print_function, unicode_literals
import os import os

View file

@ -1,3 +1,12 @@
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.
from __future__ import print_function, unicode_literals from __future__ import print_function, unicode_literals
import os import os
@ -331,6 +340,6 @@ class MachCommands(CommandBase):
opts += ["--manifest-path", manifest_path] opts += ["--manifest-path", manifest_path]
if verbose: if verbose:
opts += ["-v"] opts += ["-v"]
opts += params opts += params
return subprocess.call(["cargo", "clean"] + opts, return subprocess.call(["cargo", "clean"] + opts,
env=self.build_env(), cwd=self.servo_crate()) env=self.build_env(), cwd=self.servo_crate())

View file

@ -1,3 +1,12 @@
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.
import os import os
from os import path from os import path
import contextlib import contextlib
@ -213,25 +222,45 @@ class CommandBase(object):
env["CC"] = "arm-linux-androideabi-gcc" env["CC"] = "arm-linux-androideabi-gcc"
env["ARCH_DIR"] = "arch-arm" env["ARCH_DIR"] = "arch-arm"
env["CPPFLAGS"] = ("-DANDROID -DTARGET_OS_GONK -DGR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE=1 " env["CPPFLAGS"] = (
"-isystem %(gonkdir)s/bionic/libc/%(archdir)s/include -isystem %(gonkdir)s/bionic/libc/include/ " "-DANDROID -DTARGET_OS_GONK "
"-isystem %(gonkdir)s/bionic/libc/kernel/common -isystem %(gonkdir)s/bionic/libc/kernel/%(archdir)s " "-DGR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE=1 "
"-isystem %(gonkdir)s/bionic/libm/include -I%(gonkdir)s/system -I%(gonkdir)s/system/core/include " "-isystem %(gonkdir)s/bionic/libc/%(archdir)s/include "
"-isystem %(gonkdir)s/bionic -I%(gonkdir)s/frameworks/native/opengl/include -I%(gonkdir)s/external/zlib " "-isystem %(gonkdir)s/bionic/libc/include/ "
"-I%(gonkdir)s/hardware/libhardware/include/hardware/") % {"gonkdir": env["GONKDIR"], "archdir": env["ARCH_DIR"] } "-isystem %(gonkdir)s/bionic/libc/kernel/common "
env["CXXFLAGS"] = ("-O2 -mandroid -fPIC %(cppflags)s -I%(gonkdir)s/ndk/sources/cxx-stl/stlport/stlport " "-isystem %(gonkdir)s/bionic/libc/kernel/%(archdir)s "
"-I%(gonkdir)s/ndk/sources/cxx-stl/system/include") % {"gonkdir": env["GONKDIR"], "cppflags": env["CPPFLAGS"] } "-isystem %(gonkdir)s/bionic/libm/include "
env["CFLAGS"] = ("-O2 -mandroid -fPIC %(cppflags)s -I%(gonkdir)s/ndk/sources/cxx-stl/stlport/stlport " "-I%(gonkdir)s/system "
"-I%(gonkdir)s/ndk/sources/cxx-stl/system/include") % {"gonkdir": env["GONKDIR"], "cppflags": env["CPPFLAGS"] } "-I%(gonkdir)s/system/core/include "
"-isystem %(gonkdir)s/bionic "
"-I%(gonkdir)s/frameworks/native/opengl/include "
"-I%(gonkdir)s/external/zlib "
"-I%(gonkdir)s/hardware/libhardware/include/hardware/ "
) % {"gonkdir": env["GONKDIR"], "archdir": env["ARCH_DIR"]}
env["CXXFLAGS"] = (
"-O2 -mandroid -fPIC %(cppflags)s "
"-I%(gonkdir)s/ndk/sources/cxx-stl/stlport/stlport "
"-I%(gonkdir)s/ndk/sources/cxx-stl/system/include "
) % {"gonkdir": env["GONKDIR"], "cppflags": env["CPPFLAGS"]}
env["CFLAGS"] = (
"-O2 -mandroid -fPIC %(cppflags)s "
"-I%(gonkdir)s/ndk/sources/cxx-stl/stlport/stlport "
"-I%(gonkdir)s/ndk/sources/cxx-stl/system/include "
) % {"gonkdir": env["GONKDIR"], "cppflags": env["CPPFLAGS"]}
another_extra_path = path.join(env["GONKDIR"], "prebuilts", "gcc", "linux-x86", "arm", "arm-linux-androideabi-4.7", "bin") another_extra_path = path.join(
env["GONKDIR"], "prebuilts", "gcc", "linux-x86", "arm", "arm-linux-androideabi-4.7", "bin")
env["PATH"] = "%s%s%s" % (another_extra_path, os.pathsep, env["PATH"]) env["PATH"] = "%s%s%s" % (another_extra_path, os.pathsep, env["PATH"])
env["LDFLAGS"] = ("-mandroid -L%(gonkdir)s/out/target/product/%(gonkproduct)s/obj/lib " env["LDFLAGS"] = (
"-Wl,-rpath-link=%(gonkdir)s/out/target/product/%(gonkproduct)s/obj/lib " "-mandroid -L%(gonkdir)s/out/target/product/%(gonkproduct)s/obj/lib "
"--sysroot=%(gonkdir)s/out/target/product/%(gonkproduct)s/obj/") % {"gonkdir": env["GONKDIR"], "gonkproduct": env["GONK_PRODUCT"] } "-Wl,-rpath-link=%(gonkdir)s/out/target/product/%(gonkproduct)s/obj/lib "
"--sysroot=%(gonkdir)s/out/target/product/%(gonkproduct)s/obj/"
) % {"gonkdir": env["GONKDIR"], "gonkproduct": env["GONK_PRODUCT"]}
# Not strictly necessary for a vanilla build, but might be when tweaking the openssl build # Not strictly necessary for a vanilla build, but might be when tweaking the openssl build
openssl_dir = "%(gonkdir)s/out/target/product/%(gonkproduct)s/obj/lib" % {"gonkdir": env["GONKDIR"], "gonkproduct": env["GONK_PRODUCT"] } openssl_dir = (
"%(gonkdir)s/out/target/product/%(gonkproduct)s/obj/lib"
) % {"gonkdir": env["GONKDIR"], "gonkproduct": env["GONK_PRODUCT"]}
env["OPENSSL_LIB_DIR"] = openssl_dir env["OPENSSL_LIB_DIR"] = openssl_dir
env['OPENSSL_INCLUDE_DIR'] = path.join(openssl_dir, "include") env['OPENSSL_INCLUDE_DIR'] = path.join(openssl_dir, "include")

View file

@ -1,3 +1,12 @@
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.
from __future__ import print_function, unicode_literals from __future__ import print_function, unicode_literals
from os import path, getcwd, listdir from os import path, getcwd, listdir

View file

@ -1,3 +1,12 @@
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.
from __future__ import print_function, unicode_literals from __future__ import print_function, unicode_literals
import os import os

View file

@ -1,3 +1,12 @@
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.
from __future__ import print_function, unicode_literals from __future__ import print_function, unicode_literals
import argparse import argparse

View file

@ -100,7 +100,12 @@ def check_whitespace(idx, line):
def check_by_line(contents): def check_by_line(contents):
lines = contents.splitlines(True) lines = contents.splitlines(True)
for idx, line in enumerate(lines): for idx, line in enumerate(lines):
for error in itertools.chain(check_length(idx, line), check_whitespace(idx, line), check_whatwg_url(idx, line)): errors = itertools.chain(
check_length(idx, line),
check_whitespace(idx, line),
check_whatwg_url(idx, line),
)
for error in errors:
yield error yield error