From 3b5e9bc3826117aa23e8dfd7a26016c99df94da1 Mon Sep 17 00:00:00 2001 From: odidev Date: Wed, 13 Apr 2022 11:01:04 +0500 Subject: [PATCH] Add Linux AArch64 wheel build support Signed-off-by: odidev --- mssqlcli/mssqltoolsservice/externals.py | 10 ++++++++-- release.py | 1 + utility.py | 5 ++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/mssqlcli/mssqltoolsservice/externals.py b/mssqlcli/mssqltoolsservice/externals.py index 3da36758..ca54eef6 100644 --- a/mssqlcli/mssqltoolsservice/externals.py +++ b/mssqlcli/mssqltoolsservice/externals.py @@ -7,6 +7,7 @@ from future.standard_library import install_aliases import requests import utility +import platform install_aliases() @@ -18,6 +19,8 @@ SUPPORTED_PLATFORMS = { 'manylinux1_x86_64': SQLTOOLSSERVICE_BASE + 'manylinux1/' + 'Microsoft.SqlTools.ServiceLayer-rhel-x64-netcoreapp3.1.tar.gz', + manylinux2014_aarch64': SQLTOOLSSERVICE_BASE + 'manylinux2014/' + + 'v3.0.0-release.72.tar.gz', 'macosx_10_11_intel': SQLTOOLSSERVICE_BASE + 'macosx_10_11_intel/' + 'Microsoft.SqlTools.ServiceLayer-osx-x64-netcoreapp3.1.tar.gz', 'win_amd64': SQLTOOLSSERVICE_BASE + 'win_amd64/' + @@ -37,7 +40,10 @@ def download_sqltoolsservice_binaries(): os.makedirs(os.path.dirname(packageFilePath)) packageFileName = os.path.basename(packageFilePath) - githubUrl = 'https://github.com/microsoft/sqltoolsservice/releases/download/{}/{}'.format(SQLTOOLSSERVICE_RELEASE, packageFileName) + if platform.machine() == 'aarch64': + githubUrl = 'https://github.com/microsoft/sqltoolsservice/archive/refs/tags/v3.0.0-release.72.tar.gz' + else: + githubUrl = 'https://github.com/microsoft/sqltoolsservice/releases/download/{}/{}'.format(SQLTOOLSSERVICE_RELEASE, packageFileName) print('Downloading {}'.format(githubUrl)) r = requests.get(githubUrl) with open(packageFilePath, 'wb') as f: @@ -53,7 +59,7 @@ def copy_sqltoolsservice(platform): if not platform or platform not in SUPPORTED_PLATFORMS: print('{} is not supported.'.format(platform)) print('Please provide a valid platform flag.' + - '[win32, win_amd64, manylinux1_x86_64, macosx_10_11_intel]') + '[win32, win_amd64, manylinux1_x86_64, macosx_10_11_intel, manylinux2014_aarch64]') sys.exit(1) copy_file_path = SUPPORTED_PLATFORMS[platform] diff --git a/release.py b/release.py index 6afde6e0..2e9dc113 100644 --- a/release.py +++ b/release.py @@ -87,6 +87,7 @@ def download_official_wheels(): blob_names = [ 'mssql_cli-{}-py2.py3-none-macosx_10_11_intel.whl'.format(latest_version), 'mssql_cli-{}-py2.py3-none-manylinux1_x86_64.whl'.format(latest_version), + 'mssql_cli-{}-py2.py3-none-manylinux2014_aarch64.whl'.format(latest_version), 'mssql_cli-{}-py2.py3-none-win_amd64.whl'.format(latest_version), 'mssql_cli-{}-py2.py3-none-win32.whl'.format(latest_version) ] diff --git a/utility.py b/utility.py index c432884e..b0798327 100644 --- a/utility.py +++ b/utility.py @@ -78,7 +78,10 @@ def get_current_platform(): elif system == 'Darwin': run_time_id = 'macosx_10_11_intel' elif system == 'Linux': - run_time_id = 'manylinux1_x86_64' + if platform.machine() == 'x86_64': + run_time_id = 'manylinux1_x86_64' + elif platform.machine() == 'aarch64': + run_time_id = 'manylinux2014_aarch64' return run_time_id