mirror of
https://github.com/servo/servo.git
synced 2025-06-28 11:03:39 +01:00
Fix new flake8 warnings
This commit is contained in:
parent
98a40a432c
commit
96b8f39277
3 changed files with 44 additions and 41 deletions
|
@ -46,7 +46,7 @@ def notify_linux(title, text):
|
|||
notify_obj = bus.get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
|
||||
method = notify_obj.get_dbus_method("Notify", "org.freedesktop.Notifications")
|
||||
method(title, 0, "", text, "", [], {"transient": True}, -1)
|
||||
except:
|
||||
except ImportError:
|
||||
raise Exception("Optional Python module 'dbus' is not installed.")
|
||||
|
||||
|
||||
|
@ -55,7 +55,7 @@ def notify_win(title, text):
|
|||
from servo.win32_toast import WindowsToast
|
||||
w = WindowsToast()
|
||||
w.balloon_tip(title, text)
|
||||
except:
|
||||
except WindowsError:
|
||||
from ctypes import Structure, windll, POINTER, sizeof
|
||||
from ctypes.wintypes import DWORD, HANDLE, WINFUNCTYPE, BOOL, UINT
|
||||
|
||||
|
@ -920,7 +920,7 @@ def package_gstreamer_dlls(env, servo_exe_dir, target, uwp):
|
|||
for gst_lib in gst_dlls:
|
||||
try:
|
||||
shutil.copy(path.join(gst_root, "bin", gst_lib), servo_exe_dir)
|
||||
except:
|
||||
except FileNotFoundError:
|
||||
missing += [str(gst_lib)]
|
||||
|
||||
for gst_lib in missing:
|
||||
|
@ -976,7 +976,7 @@ def package_gstreamer_dlls(env, servo_exe_dir, target, uwp):
|
|||
for gst_lib in gst_dlls:
|
||||
try:
|
||||
shutil.copy(path.join(gst_plugin_path, gst_lib), servo_exe_dir)
|
||||
except:
|
||||
except FileNotFoundError:
|
||||
missing += [str(gst_lib)]
|
||||
|
||||
for gst_lib in missing:
|
||||
|
|
|
@ -487,7 +487,7 @@ class CommandBase(object):
|
|||
print("Could not fetch the available nightly versions from the repository : {}".format(
|
||||
e.reason))
|
||||
sys.exit(1)
|
||||
except AttributeError as e:
|
||||
except AttributeError:
|
||||
print("Could not fetch a nightly version for date {} and platform {}".format(
|
||||
nightly_date, os_prefix))
|
||||
sys.exit(1)
|
||||
|
@ -517,8 +517,8 @@ class CommandBase(object):
|
|||
else:
|
||||
print("The nightly {} does not exist yet, downloading it.".format(
|
||||
destination_file))
|
||||
download_file(destination_file, NIGHTLY_REPOSITORY_URL +
|
||||
file_to_download, destination_file)
|
||||
download_file(destination_file, NIGHTLY_REPOSITORY_URL
|
||||
+ file_to_download, destination_file)
|
||||
|
||||
# Extract the downloaded nightly version
|
||||
if os.path.isdir(destination_folder):
|
||||
|
@ -537,7 +537,7 @@ class CommandBase(object):
|
|||
try:
|
||||
if check_gstreamer_lib():
|
||||
return False
|
||||
except:
|
||||
except subprocess.SubprocessError:
|
||||
# Some systems don't have pkg-config; we can't probe in this case
|
||||
# and must hope for the best
|
||||
return False
|
||||
|
@ -552,7 +552,7 @@ class CommandBase(object):
|
|||
raise Exception("Your system's gstreamer libraries are out of date \
|
||||
(we need at least 1.16). Please run ./mach bootstrap-gstreamer")
|
||||
else:
|
||||
raise Exception("Your system's gstreamer libraries are out of date \
|
||||
raise Exception("Your system's gstreamer libraries are out of date \
|
||||
(we need at least 1.16). If you're unable to \
|
||||
install them, let us know by filing a bug!")
|
||||
return False
|
||||
|
@ -858,9 +858,9 @@ install them, let us know by filing a bug!")
|
|||
def pick_media_stack(self, media_stack, target):
|
||||
if not(media_stack):
|
||||
if (
|
||||
not(target) or
|
||||
("armv7" in target and "android" in target) or
|
||||
("x86_64" in target)
|
||||
not(target)
|
||||
or ("armv7" in target and "android" in target)
|
||||
or ("x86_64" in target)
|
||||
):
|
||||
media_stack = "gstreamer"
|
||||
else:
|
||||
|
@ -1032,7 +1032,7 @@ install them, let us know by filing a bug!")
|
|||
print()
|
||||
sys.exit(1)
|
||||
raise
|
||||
version = tuple(map(int, re.match(b"rustup (\d+)\.(\d+)\.(\d+)", version_line).groups()))
|
||||
version = tuple(map(int, re.match(br"rustup (\d+)\.(\d+)\.(\d+)", version_line).groups()))
|
||||
version_needed = (1, 21, 0)
|
||||
if version < version_needed:
|
||||
print("rustup is at version %s.%s.%s, Servo requires %s.%s.%s or more recent." % (version + version_needed))
|
||||
|
@ -1069,8 +1069,8 @@ install them, let us know by filing a bug!")
|
|||
|
||||
def find_highest_msvc_version_ext():
|
||||
def vswhere(args):
|
||||
program_files = (os.environ.get('PROGRAMFILES(X86)') or
|
||||
os.environ.get('PROGRAMFILES'))
|
||||
program_files = (os.environ.get('PROGRAMFILES(X86)')
|
||||
or os.environ.get('PROGRAMFILES'))
|
||||
if not program_files:
|
||||
return []
|
||||
vswhere = os.path.join(program_files, 'Microsoft Visual Studio',
|
||||
|
@ -1107,8 +1107,8 @@ def find_highest_msvc_version():
|
|||
|
||||
versions = sorted(find_highest_msvc_version_ext(), key=lambda tup: float(tup[1]))
|
||||
if not versions:
|
||||
print("Can't find MSBuild.exe installation under %s. Please set the VSINSTALLDIR and VisualStudioVersion" +
|
||||
" environment variables" % base_vs_path)
|
||||
print("Can't find MSBuild.exe installation under %s. Please set the VSINSTALLDIR and VisualStudioVersion"
|
||||
+ " environment variables" % base_vs_path)
|
||||
sys.exit(1)
|
||||
return versions[0]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue