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
5858
5959MSSQLTOOLSSERVICE_PACKAGE_NAME = 'mssqltoolsservice-{}=={}'
6060MSSQLTOOLSSERVICE_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
17568def _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