Skip to content

Commit 80c6df1

Browse files
authored
Upgrade to latest and download the SqlToolsService (#506)
* Upgrade to latest sqltoolsservice * Change pip resolution in dev_setup.py * Download the sqltoolsservice platform specific packages from github
1 parent b879daf commit 80c6df1

File tree

6 files changed

+30
-6
lines changed

6 files changed

+30
-6
lines changed

dev_setup.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
#!/usr/bin/env python
22
from __future__ import print_function
3+
34
import os
5+
import sys
46
import utility
57

6-
PIP = os.getenv('CUSTOM_PIP', 'pip')
8+
PYTHON = os.getenv('CUSTOM_PYTHON', sys.executable)
79

810
print('Running dev setup...')
911
print('Root directory \'%s\'\n' % utility.ROOT_DIR)
1012

1113
# install general requirements.
12-
utility.exec_command('%s install --no-cache-dir -r requirements-dev.txt' % PIP,
14+
utility.exec_command('%s -m pip install --no-cache-dir -r requirements-dev.txt' % PYTHON,
1315
utility.ROOT_DIR)
1416

17+
import mssqlcli.mssqltoolsservice.externals as mssqltoolsservice
18+
19+
# download the sqltoolssevice binaries for all platforms
20+
mssqltoolsservice.download_sqltoolsservice_binaries()
21+
1522
# install mssqltoolsservice if this platform supports it.
1623
utility.copy_current_platform_mssqltoolsservice()
1724

mssqlcli/mssqltoolsservice/externals.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,43 @@
55
import tarfile
66
import zipfile
77
from future.standard_library import install_aliases
8+
import requests
89
import utility
910

1011
install_aliases()
1112

13+
SQLTOOLSSERVICE_RELEASE = "v3.0.0-release.72"
14+
1215
SQLTOOLSSERVICE_BASE = os.path.join(utility.ROOT_DIR, 'sqltoolsservice/')
1316

1417
# Supported platform key's must match those in mssqlscript's setup.py.
1518
SUPPORTED_PLATFORMS = {
1619
'manylinux1_x86_64': SQLTOOLSSERVICE_BASE + 'manylinux1/' +
17-
'Microsoft.SqlTools.ServiceLayer-rhel-x64-netcoreapp2.2.tar.gz',
20+
'Microsoft.SqlTools.ServiceLayer-rhel-x64-netcoreapp3.1.tar.gz',
1821
'macosx_10_11_intel': SQLTOOLSSERVICE_BASE + 'macosx_10_11_intel/' +
19-
'Microsoft.SqlTools.ServiceLayer-osx-x64-netcoreapp2.2.tar.gz',
22+
'Microsoft.SqlTools.ServiceLayer-osx-x64-netcoreapp3.1.tar.gz',
2023
'win_amd64': SQLTOOLSSERVICE_BASE + 'win_amd64/' +
21-
'Microsoft.SqlTools.ServiceLayer-win-x64-netcoreapp2.2.zip',
24+
'Microsoft.SqlTools.ServiceLayer-win-x64-netcoreapp3.1.zip',
2225
'win32': SQLTOOLSSERVICE_BASE + 'win32/' +
23-
'Microsoft.SqlTools.ServiceLayer-win-x86-netcoreapp2.2.zip'
26+
'Microsoft.SqlTools.ServiceLayer-win-x86-netcoreapp3.1.zip'
2427
}
2528

2629
TARGET_DIRECTORY = os.path.abspath(os.path.join(os.path.abspath(__file__), '..', 'bin'))
2730

31+
def download_sqltoolsservice_binaries():
32+
"""
33+
Download each for the plaform specific sqltoolsservice packages
34+
"""
35+
for packageFilePath in SUPPORTED_PLATFORMS.values():
36+
if not os.path.exists(os.path.dirname(packageFilePath)):
37+
os.makedirs(os.path.dirname(packageFilePath))
38+
39+
packageFileName = os.path.basename(packageFilePath)
40+
githubUrl = 'https://github.com/microsoft/sqltoolsservice/releases/download/{}/{}'.format(SQLTOOLSSERVICE_RELEASE, packageFileName)
41+
print('Downloading {}'.format(githubUrl))
42+
r = requests.get(githubUrl)
43+
with open(packageFilePath, 'wb') as f:
44+
f.write(r.content)
2845

2946
def copy_sqltoolsservice(platform):
3047
"""
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)