Skip to content

Commit

Permalink
chore: fix pylint (#31207)
Browse files Browse the repository at this point in the history
* chore: fix pylint

* chore: fix linter errors
  • Loading branch information
alexeykuzmin committed Sep 30, 2021
1 parent b62cef5 commit 844d104
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 10 deletions.
5 changes: 2 additions & 3 deletions script/lib/git.py
Expand Up @@ -232,9 +232,8 @@ def remove_patch_filename(patch):
def export_patches(repo, out_dir, patch_range=None, dry_run=False):
if patch_range is None:
patch_range, num_patches = guess_base_commit(repo)
sys.stderr.write(
"Exporting {} patches in {} since {}\n".format(num_patches, repo, patch_range[0:7])
)
sys.stderr.write("Exporting {} patches in {} since {}\n".format(
num_patches, repo, patch_range[0:7]))
patch_data = format_patch(repo, patch_range)
patches = split_patches(patch_data)

Expand Down
2 changes: 1 addition & 1 deletion script/lib/native_tests.py
Expand Up @@ -4,7 +4,7 @@
import subprocess
import sys

from util import SRC_DIR
from lib.util import SRC_DIR

PYYAML_LIB_DIR = os.path.join(SRC_DIR, 'third_party', 'pyyaml', 'lib')
sys.path.append(PYYAML_LIB_DIR)
Expand Down
19 changes: 16 additions & 3 deletions script/lint.js
Expand Up @@ -29,8 +29,21 @@ const IS_WINDOWS = process.platform === 'win32';

function spawnAndCheckExitCode (cmd, args, opts) {
opts = Object.assign({ stdio: 'inherit' }, opts);
const status = childProcess.spawnSync(cmd, args, opts).status;
if (status) process.exit(status);
const { error, status, signal } = childProcess.spawnSync(cmd, args, opts);
if (error) {
// the subsprocess failed or timed out
console.error(error);
process.exit(1);
}
if (status === null) {
// the subprocess terminated due to a signal
console.error(signal);
process.exit(1);
}
if (status !== 0) {
// `status` is an exit code
process.exit(status);
}
}

function cpplint (args) {
Expand Down Expand Up @@ -91,7 +104,7 @@ const LINTERS = [{
const rcfile = path.join(DEPOT_TOOLS, 'pylintrc');
const args = ['--rcfile=' + rcfile, ...filenames];
const env = Object.assign({ PYTHONPATH: path.join(SOURCE_ROOT, 'script') }, process.env);
spawnAndCheckExitCode('pylint.py', args, { env });
spawnAndCheckExitCode('pylint', args, { env });
}
}, {
key: 'javascript',
Expand Down
2 changes: 1 addition & 1 deletion script/patches-mtime-cache.py
Expand Up @@ -135,7 +135,7 @@ def main():
json.load(f) # Make sure it's not an empty file
print("Using existing mtime cache for patches")
return 0
except:
except Exception:
pass

try:
Expand Down
3 changes: 2 additions & 1 deletion script/release/uploaders/upload.py
Expand Up @@ -100,7 +100,8 @@ def main():
# Upload libcxx_objects.zip for linux only
libcxx_objects = get_zip_name('libcxx-objects', ELECTRON_VERSION)
libcxx_objects_zip = os.path.join(OUT_DIR, libcxx_objects)
shutil.copy2(os.path.join(OUT_DIR, 'libcxx_objects.zip'), libcxx_objects_zip)
shutil.copy2(os.path.join(OUT_DIR, 'libcxx_objects.zip'),
libcxx_objects_zip)
upload_electron(release, libcxx_objects_zip, args)

# Upload headers.zip and abi_headers.zip as non-platform specific
Expand Down
3 changes: 2 additions & 1 deletion script/verify-ffmpeg.py
Expand Up @@ -48,7 +48,8 @@ def main():
# FIXME: Enable after ELECTRON_ENABLE_LOGGING works again
# env['ELECTRON_ENABLE_LOGGING'] = 'true'
testargs = [electron, test_path]
if sys.platform != 'linux' and (platform.machine() == 'ARM64' or os.environ.get('TARGET_ARCH') == 'arm64'):
if sys.platform != 'linux' and (platform.machine() == 'ARM64' or
os.environ.get('TARGET_ARCH') == 'arm64'):
testargs.append('--disable-accelerated-video-decode')
subprocess.check_call(testargs, env=env)
except subprocess.CalledProcessError as e:
Expand Down

0 comments on commit 844d104

Please sign in to comment.