Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix alerts from LGTM about python files #8383

Merged
merged 3 commits into from Sep 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion distribution/bin/check-licenses.py
Expand Up @@ -16,7 +16,6 @@
# limitations under the License.

import yaml
import json
import os
import sys
from html.parser import HTMLParser
Expand Down
6 changes: 2 additions & 4 deletions distribution/bin/find-missing-backports.py
Expand Up @@ -20,7 +20,6 @@
import requests
import subprocess
import sys
import time


def extract_pr_title_from_commit_message(commit_msg):
Expand Down Expand Up @@ -48,7 +47,7 @@ def extract_pr_title(pr_json):
def find_missing_backports(pr_jsons, release_pr_subjects):
for pr in pr_jsons:
if pr['milestone'] is not None:
if pr['milestone']['number'] is milestone_number:
if pr['milestone']['number'] == milestone_number:
for pr_title_candidate in extract_pr_title(pr):
if pr_title_candidate in release_pr_subjects:
return
Expand All @@ -65,8 +64,7 @@ def find_next_url(links):
else:
url_holder = match_result.group(0)
return url_holder[1:-1]
else:
return None
return None


if len(sys.argv) != 5:
Expand Down
9 changes: 3 additions & 6 deletions distribution/bin/generate-license-dependency-reports.py
Expand Up @@ -18,11 +18,8 @@
import os
import shutil
import subprocess
import sys
import argparse
import concurrent.futures
import time
import threading


def generate_report(module_path, report_orig_path, report_out_path):
Expand All @@ -48,7 +45,7 @@ def generate_report(module_path, report_orig_path, report_out_path):
def generate_reports(druid_path, tmp_path, exclude_ext, num_threads):
tmp_path = os.path.abspath(tmp_path)
license_report_root = os.path.join(tmp_path, "license-reports")
license_core_path = os.path.join(license_report_root, "core")
license_core_path = os.path.join(license_report_root, "core")
license_ext_path = os.path.join(license_report_root, "ext")
shutil.rmtree(license_report_root, ignore_errors=True)
os.makedirs(license_core_path)
Expand All @@ -70,7 +67,7 @@ def generate_reports(druid_path, tmp_path, exclude_ext, num_threads):

extension_report_dir = "{}/{}".format(license_ext_path, extension_dir)
script_args.append((extension_path, os.path.join(extension_path, "target", "site"), extension_report_dir))

print("Generating dependency reports")

if num_threads > 1:
Expand All @@ -96,7 +93,7 @@ def generate_reports(druid_path, tmp_path, exclude_ext, num_threads):
if args.clean_mvn_artifact_transfer:
command = "rm -rf ~/.m2/repository/org/apache/maven/shared/maven-artifact-transfer"
subprocess.check_call(command, shell=True)

generate_reports(args.druid_path, args.tmp_path, args.exclude_ext, args.num_threads)
except KeyboardInterrupt:
print('Interrupted, closing.')
6 changes: 3 additions & 3 deletions distribution/bin/jar-notice-lister.py
Expand Up @@ -34,22 +34,22 @@ def main():
tmp_lib_path = tmp_path + "/1-lib"
os.mkdir(tmp_lib_path)
command = "cp -r {}/* {}".format(lib_path, tmp_lib_path)
outstr = subprocess.check_output(command, shell=True).decode('UTF-8')
subprocess.check_output(command, shell=True).decode('UTF-8')

# copy hadoop deps to the staging dir
hdeps_path = druid_path + "/hadoop-dependencies"
tmp_hdeps_path = tmp_path + "/2-hdeps"
os.mkdir(tmp_hdeps_path)
command = "cp -r {}/* {}".format(hdeps_path, tmp_hdeps_path)
outstr = subprocess.check_output(command, shell=True).decode('UTF-8')
subprocess.check_output(command, shell=True).decode('UTF-8')


# copy all extension folders to the staging dir
ext_path = druid_path + "/extensions"
tmp_ext_path = tmp_path + "/3-ext"
os.mkdir(tmp_ext_path)
command = "cp -r {}/* {}".format(ext_path, tmp_ext_path)
outstr = subprocess.check_output(command, shell=True).decode('UTF-8')
subprocess.check_output(command, shell=True).decode('UTF-8')


get_notices(tmp_path)
Expand Down