Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit 5d1927e

Browse files
authored
Update/consolidate linux install (#153)
* universal linux wheel gen and setup update. * Updating version cfg. * Updating sqltoolsservice container. * Updating spacing for flake8.
1 parent 6bf25d8 commit 5d1927e

File tree

6 files changed

+14
-126
lines changed

6 files changed

+14
-126
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.0.0a20
2+
current_version = 1.0.0a21
33
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((?P<release>[a-z]+))(?P<release_version>\d+)
44
serialize =
55
{major}.{minor}.{patch}{release}{release_version}

mssqlscripter/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# Licensed under the MIT License. See License.txt in the project root for license information.
44
# --------------------------------------------------------------------------------------------
55

6-
__version__ = '1.0.0a20'
6+
__version__ = '1.0.0a21'

mssqltoolsservice/buildwheels.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,14 @@
1717
from urllib.request import urlopen
1818

1919

20-
DOWNLOAD_URL_BASE = 'https://mssqlscripter.blob.core.windows.net/sqltoolsservice-08-16-2017/'
20+
DOWNLOAD_URL_BASE = 'https://mssqlscripter.blob.core.windows.net/sqltoolsservice-10-12-2017/'
2121

2222
# Supported platform key's must match those in mssqlscript's setup.py.
2323
SUPPORTED_PLATFORMS = {
24-
'CentOS_7': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-centos-x64-netcoreapp2.0.tar.gz',
25-
'Debian_8': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-debian-x64-netcoreapp2.0.tar.gz',
26-
'Fedora_23': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-fedora-x64-netcoreapp2.0.tar.gz',
27-
'openSUSE_13_2': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-opensuse-x64-netcoreapp2.0.tar.gz',
28-
'OSX_10_11_64': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-osx-x64-netcoreapp2.0.tar.gz',
29-
'RHEL_7': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-rhel-x64-netcoreapp2.0.tar.gz',
30-
'Ubuntu_14': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-ubuntu14-x64-netcoreapp2.0.tar.gz',
31-
'Ubuntu_16': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-ubuntu16-x64-netcoreapp2.0.tar.gz',
32-
'Windows_7_64': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-win-x64-netcoreapp2.0.zip',
33-
'Windows_7_86': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-win-x86-netcoreapp2.0.zip'
24+
'Linux_64': DOWNLOAD_URL_BASE + 'Microsoft.SqlTools.ServiceLayer-linux-x64-netcoreapp2.0.tar.gz',
25+
'OSX_10_11_64': DOWNLOAD_URL_BASE + 'Microsoft.SqlTools.ServiceLayer-osx-x64-netcoreapp2.0.tar.gz',
26+
'Windows_7_64': DOWNLOAD_URL_BASE + 'Microsoft.SqlTools.ServiceLayer-win-x64-netcoreapp2.0.zip',
27+
'Windows_7_86': DOWNLOAD_URL_BASE + 'Microsoft.SqlTools.ServiceLayer-win-x86-netcoreapp2.0.zip'
3428
}
3529

3630
CURRENT_DIRECTORY = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))
@@ -78,6 +72,7 @@ def build_sqltoolsservice_wheels(platforms):
7872
os.environ[u'MSSQLTOOLSSERVICE_PLATFORM'] = platform
7973

8074
print(u'Calling setup bdist_wheel for platform:{}'.format(platform))
75+
print(SUPPORTED_PLATFORMS[platform])
8176
download_and_unzip(SUPPORTED_PLATFORMS[platform], directory=TARGET_DIRECTORY)
8277
utility.exec_command(u'python setup.py check -r -s bdist_wheel', CURRENT_DIRECTORY)
8378

mssqltoolsservice/mssqltoolsservice/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import os
1010
import platform
1111

12-
__version__ = '1.0.0a20'
12+
__version__ = '1.0.0a21'
1313

1414

1515
def get_executable_path():

mssqltoolsservice/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
# This version number is in place in two places and must be in sync with
1414
# mssqlscripter's version in setup.py.
15-
MSSQLTOOLSSERVICE_VERSION = '1.0.0a20'
15+
MSSQLTOOLSSERVICE_VERSION = '1.0.0a21'
1616

1717
# If we have source, validate version numbers match to prevent
1818
# uploading releases with mismatched versions.

setup.py

Lines changed: 4 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
# This version number is in place in two places and must be in sync with
1616
# mssqltoolsservice's version in setup.py.
17-
MSSQLSCRIPTER_VERSION = '1.0.0a20'
17+
MSSQLSCRIPTER_VERSION = '1.0.0a21'
1818

1919
# If we have the source, validate our setup version matches source version.
2020
# This will prevent uploading releases with mismatched versions. This will
@@ -58,119 +58,12 @@
5858

5959
MSSQLTOOLSSERVICE_PACKAGE_NAME = 'mssqltoolsservice-{}=={}'
6060
MSSQLTOOLSSERVICE_PACKAGE_SUFFIX = [
61-
'CentOS_7',
62-
'Debian_8',
63-
'Fedora_23',
64-
'openSUSE_13_2',
6561
'OSX_10_11_64',
66-
'RHEL_7',
67-
'Ubuntu_14',
68-
'Ubuntu_16',
6962
'Windows_7_64',
70-
'Windows_7_86'
63+
'Windows_7_86',
64+
'Linux_64'
7165
]
7266

73-
LINUX_DISTRO_NO_VERSION = {
74-
'centos': 'CentOS_7',
75-
'ol': 'CentOS_7',
76-
'fedora': 'Fedora_23',
77-
'opensuse': 'OpenSUSE_13_2',
78-
'rhel': 'RHEL_7',
79-
'debian': 'Debian_8',
80-
}
81-
82-
LINUX_DISTRO_WITH_VERSION = {
83-
'ubuntu':
84-
{
85-
'14': 'Ubuntu_14',
86-
'16': 'Ubuntu_16'
87-
},
88-
'elementary':
89-
{
90-
'0.3': 'Ubuntu_14',
91-
'0.4': 'Ubuntu_16'
92-
},
93-
'elementaryOS':
94-
{
95-
'0.3': 'Ubuntu_14',
96-
'0.4': 'Ubuntu_16'
97-
},
98-
'linuxmint':
99-
{
100-
'18': 'Ubuntu_16'
101-
},
102-
'galliumos':
103-
{
104-
'2.0': 'Ubuntu_16'
105-
},
106-
}
107-
108-
109-
def _get_runtime_id_helper(name, version):
110-
"""
111-
Checks if linux distro name and version match to a supported package.
112-
"""
113-
if name in LINUX_DISTRO_NO_VERSION:
114-
return LINUX_DISTRO_NO_VERSION[name]
115-
116-
if name in LINUX_DISTRO_WITH_VERSION:
117-
for supported_version in LINUX_DISTRO_WITH_VERSION[name]:
118-
if version.startswith(supported_version):
119-
return LINUX_DISTRO_WITH_VERSION[name][supported_version]
120-
return None
121-
122-
123-
def _get_linux_distro_runtime_id(content):
124-
"""
125-
Parse content for linux distro run time id.
126-
"""
127-
name = None
128-
version = None
129-
id_like = None
130-
131-
# Try to find name, version and id_like best effort.
132-
for line in content.splitlines():
133-
key, value = line.rstrip().split('=')
134-
value = value.strip('"')
135-
if key == 'ID':
136-
name = value
137-
elif key == 'VERSION_ID':
138-
version = value
139-
elif key == 'ID_LIKE':
140-
id_like = value.split(' ')
141-
if name and version and id_like:
142-
break
143-
# First try the distribution name.
144-
run_time_id = _get_runtime_id_helper(name, version)
145-
146-
# If we don't understand it, try the 'ID_LIKE' field.
147-
if not run_time_id and id_like:
148-
for name in id_like:
149-
run_time_id = _get_runtime_id_helper(name, version)
150-
if run_time_id:
151-
break
152-
153-
return run_time_id
154-
155-
156-
def _get_linux_distro_from_file():
157-
"""
158-
Find linux distro based on
159-
https://www.freedesktop.org/software/systemd/man/os-release.html.
160-
"""
161-
os_release_info_file = None
162-
163-
if os.path.exists('/etc/os-release'):
164-
os_release_info_file = '/etc/os-release'
165-
elif os.path.exists('/usr/lib/os-release'):
166-
os_release_info_file = '/usr/lib/os-release'
167-
else:
168-
raise EnvironmentError('Error detecting Linux distro version.')
169-
170-
with io.open(os_release_info_file, 'r', encoding='utf-8') as os_release_file:
171-
content = os_release_file.read()
172-
return _get_linux_distro_runtime_id(content)
173-
17467

17568
def _get_runtime_id(
17669
system=_platform.system(),
@@ -191,7 +84,7 @@ def _get_runtime_id(
19184
run_time_id = 'OSX_10_11_64'
19285
elif system == 'Linux':
19386
if architecture == '64bit':
194-
run_time_id = _get_linux_distro_from_file()
87+
run_time_id = 'Linux_64'
19588

19689
return run_time_id
19790

0 commit comments

Comments
 (0)