diff --git a/build-binary.py b/build-binary.py index 2cb187ad3f8e9fcd8d52e1333d664c482f162bbd..c6f707b24c74531801338921827c5ffcbb85187b 100755 --- a/build-binary.py +++ b/build-binary.py @@ -3,8 +3,8 @@ import os, shutil from glob import glob from subprocess import check_call -from utils import get_build_versions, ex, get_sha256, zip_files, get_final_file_name, \ - get_sources_file_name, get_pom_file_name, reset_time, get_version_number, check_go_version, \ +from utils import get_build_versions, ex, get_sha256, zip_files, get_final_file_path, \ + get_sources_file_path, get_pom_file_path, reset_time, get_version_number, check_go_version, \ get_version_and_tool, get_output_dir, get_platform_output_dir, GO_PATH, GO_ROOT, NDK_DIR @@ -193,7 +193,7 @@ def package_windows(tool, versions): def package(tool, versions, file_list, platform): - zip_file = get_final_file_name(tool, versions, platform) + zip_file = get_final_file_path(tool, versions, platform) zip_files(file_list, zip_file, versions) create_sources_jar(tool, versions, platform) create_pom_file(tool, versions, platform) @@ -215,19 +215,18 @@ def create_sources_jar(tool, versions, platform): for file in glob(os.path.join(repo_dir, '*')): reset_time(file, versions) jar_files.append(os.path.relpath(file, repo_dir)) - jar_path = get_sources_file_name(tool, versions, platform) + jar_path = get_sources_file_path(tool, versions, platform) check_call(['jar', 'cf', jar_path] + jar_files, cwd=repo_dir) def create_pom_file(tool, versions, platform): tool_version = get_version_number(versions) - pom_file = get_pom_file_name(tool, versions, platform) + pom_file = get_pom_file_path(tool, versions, platform) template = 'template-%s-%s.pom' % (tool, platform) with open(template, 'rt') as infile: with open(pom_file, 'wt') as outfile: for line in infile: outfile.write(line.replace('VERSION', tool_version)) - return pom_file if __name__ == "__main__": diff --git a/utils.py b/utils.py index 68abaadd19fce854d28d4942ee21aa7a4c3658bf..c45e88dc4d28dbecad3622f9b6d8fa225fea6f3a 100644 --- a/utils.py +++ b/utils.py @@ -76,23 +76,23 @@ def get_version_number(versions): return versions['tag'] -def get_output_file(tool, versions, platform, suffix): +def get_output_file_path(tool, versions, platform, suffix): output_dir = get_platform_output_dir(tool, platform) version = get_version_number(versions) filename = '%s-%s-%s%s' % (tool, platform, version, suffix) return os.path.join(output_dir, filename) -def get_final_file_name(tool, versions, platform): - return get_output_file(tool, versions, platform, '.jar') +def get_final_file_path(tool, versions, platform): + return get_output_file_path(tool, versions, platform, '.jar') -def get_sources_file_name(tool, versions, platform): - return get_output_file(tool, versions, platform, '-sources.jar') +def get_sources_file_path(tool, versions, platform): + return get_output_file_path(tool, versions, platform, '-sources.jar') -def get_pom_file_name(tool, versions, platform): - return get_output_file(tool, versions, platform, '.pom') +def get_pom_file_path(tool, versions, platform): + return get_output_file_path(tool, versions, platform, '.pom') def get_output_dir(tool): diff --git a/verify-binary.py b/verify-binary.py index 7c69ebfef212103b4e6d9f6786c0b47eaf281821..0e9f0ed69e5cbf25fc7331b3827b13b832846933 100755 --- a/verify-binary.py +++ b/verify-binary.py @@ -3,7 +3,7 @@ import os import sys from subprocess import check_call, CalledProcessError -from utils import get_sha256, fail, get_build_versions, get_final_file_name, \ +from utils import get_sha256, fail, get_build_versions, get_final_file_path, \ get_version_and_tool, get_version_number @@ -25,7 +25,7 @@ def verify(tool, command_line_version, platform): tool_version, versions = get_build_versions(tool, command_line_version) # download reference binary - file_name = get_final_file_name(tool, versions, platform) + file_name = os.path.basename(get_final_file_path(tool, versions, platform)) os.makedirs('reference', exist_ok=True) reference_file_name = os.path.join('reference', file_name) # try downloading from maven central @@ -58,7 +58,7 @@ def verify(tool, command_line_version, platform): def get_url(tool, versions, platform): version = get_version_number(versions) directory = "%s-%s" % (tool, platform) - file = get_final_file_name(tool, versions, platform) + file = os.path.basename(get_final_file_path(tool, versions, platform)) return "https://repo.maven.apache.org/maven2/org/briarproject/%s/%s/%s" % (directory, version, file)