chore: fix pylint (#31138)
* chore: fix pylint * chore: fix linter errors
This commit is contained in:
		
					parent
					
						
							
								22d683e3f8
							
						
					
				
			
			
				commit
				
					
						2d111a4e25
					
				
			
		
					 6 changed files with 24 additions and 10 deletions
				
			
		|  | @ -232,9 +232,8 @@ def remove_patch_filename(patch): | ||||||
| def export_patches(repo, out_dir, patch_range=None, dry_run=False): | def export_patches(repo, out_dir, patch_range=None, dry_run=False): | ||||||
|   if patch_range is None: |   if patch_range is None: | ||||||
|     patch_range, num_patches = guess_base_commit(repo) |     patch_range, num_patches = guess_base_commit(repo) | ||||||
|     sys.stderr.write( |     sys.stderr.write("Exporting {} patches in {} since {}\n".format( | ||||||
|         "Exporting {} patches in {} since {}\n".format(num_patches, repo, patch_range[0:7]) |         num_patches, repo, patch_range[0:7])) | ||||||
|     ) |  | ||||||
|   patch_data = format_patch(repo, patch_range) |   patch_data = format_patch(repo, patch_range) | ||||||
|   patches = split_patches(patch_data) |   patches = split_patches(patch_data) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -4,7 +4,7 @@ import os | ||||||
| import subprocess | import subprocess | ||||||
| import sys | 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') | PYYAML_LIB_DIR = os.path.join(SRC_DIR, 'third_party', 'pyyaml', 'lib') | ||||||
| sys.path.append(PYYAML_LIB_DIR) | sys.path.append(PYYAML_LIB_DIR) | ||||||
|  |  | ||||||
|  | @ -29,8 +29,21 @@ const IS_WINDOWS = process.platform === 'win32'; | ||||||
| 
 | 
 | ||||||
| function spawnAndCheckExitCode (cmd, args, opts) { | function spawnAndCheckExitCode (cmd, args, opts) { | ||||||
|   opts = Object.assign({ stdio: 'inherit' }, opts); |   opts = Object.assign({ stdio: 'inherit' }, opts); | ||||||
|   const status = childProcess.spawnSync(cmd, args, opts).status; |   const { error, status, signal } = childProcess.spawnSync(cmd, args, opts); | ||||||
|   if (status) process.exit(status); |   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) { | function cpplint (args) { | ||||||
|  | @ -91,7 +104,7 @@ const LINTERS = [{ | ||||||
|     const rcfile = path.join(DEPOT_TOOLS, 'pylintrc'); |     const rcfile = path.join(DEPOT_TOOLS, 'pylintrc'); | ||||||
|     const args = ['--rcfile=' + rcfile, ...filenames]; |     const args = ['--rcfile=' + rcfile, ...filenames]; | ||||||
|     const env = Object.assign({ PYTHONPATH: path.join(SOURCE_ROOT, 'script') }, process.env); |     const env = Object.assign({ PYTHONPATH: path.join(SOURCE_ROOT, 'script') }, process.env); | ||||||
|     spawnAndCheckExitCode('pylint.py', args, { env }); |     spawnAndCheckExitCode('pylint', args, { env }); | ||||||
|   } |   } | ||||||
| }, { | }, { | ||||||
|   key: 'javascript', |   key: 'javascript', | ||||||
|  |  | ||||||
|  | @ -135,7 +135,7 @@ def main(): | ||||||
|                 json.load(f)  # Make sure it's not an empty file |                 json.load(f)  # Make sure it's not an empty file | ||||||
|                 print("Using existing mtime cache for patches") |                 print("Using existing mtime cache for patches") | ||||||
|                 return 0 |                 return 0 | ||||||
|         except: |         except Exception: | ||||||
|             pass |             pass | ||||||
| 
 | 
 | ||||||
|         try: |         try: | ||||||
|  |  | ||||||
|  | @ -100,7 +100,8 @@ def main(): | ||||||
|     # Upload libcxx_objects.zip for linux only |     # Upload libcxx_objects.zip for linux only | ||||||
|     libcxx_objects = get_zip_name('libcxx-objects', ELECTRON_VERSION) |     libcxx_objects = get_zip_name('libcxx-objects', ELECTRON_VERSION) | ||||||
|     libcxx_objects_zip = os.path.join(OUT_DIR, libcxx_objects) |     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_electron(release, libcxx_objects_zip, args) | ||||||
| 
 | 
 | ||||||
|     # Upload headers.zip and abi_headers.zip as non-platform specific |     # Upload headers.zip and abi_headers.zip as non-platform specific | ||||||
|  |  | ||||||
|  | @ -48,7 +48,8 @@ def main(): | ||||||
|     # FIXME: Enable after ELECTRON_ENABLE_LOGGING works again |     # FIXME: Enable after ELECTRON_ENABLE_LOGGING works again | ||||||
|     # env['ELECTRON_ENABLE_LOGGING'] = 'true' |     # env['ELECTRON_ENABLE_LOGGING'] = 'true' | ||||||
|     testargs = [electron, test_path] |     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') |       testargs.append('--disable-accelerated-video-decode') | ||||||
|     subprocess.check_call(testargs, env=env) |     subprocess.check_call(testargs, env=env) | ||||||
|   except subprocess.CalledProcessError as e: |   except subprocess.CalledProcessError as e: | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alexey Kuzmin
				Alexey Kuzmin