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

Commit 2a4a592

Browse files
authored
Ron/sqltoolsservice update (#163)
* Updating sqltoolsservice with self contained version. * Refreshing sqltoolsservice again. * Making mssql-scripter executable and adding null checks in main.py * Adding clean up step to remove build directory after each build. * Fixing path for build directory.
1 parent d575a25 commit 2a4a592

9 files changed

+23
-15
lines changed

build.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def build(platform_names):
2929

3030
# clean
3131
utility.clean_up(utility.MSSQLSCRIPTER_DIST_DIRECTORY)
32-
utility.cleaun_up_egg_info_sub_directories(utility.ROOT_DIR)
3332

3433
print_heading('Running setup')
3534

@@ -40,12 +39,15 @@ def build(platform_names):
4039
utility.exec_command('python dos2unix.py mssql-scripter mssql-scripter', utility.ROOT_DIR)
4140

4241
for platform in platform_names:
42+
utility.clean_up(utility.MSSQLSCRIPTER_BUILD_DIRECTORY)
43+
utility.cleaun_up_egg_info_sub_directories(utility.ROOT_DIR)
44+
4345
mssqltoolsservice.copy_sqltoolsservice(platform)
4446

4547
print_heading('Building mssql-scripter {} wheel package package'.format(platform))
4648
utility.exec_command('python --version', utility.ROOT_DIR)
4749
utility.exec_command(
48-
'python setup.py check -r -s bdist_wheel --plat-name {}'.format(platform),
50+
'python setup.py check -r -s bdist_wheel --plat-name {}'.format(platform),
4951
utility.ROOT_DIR,
5052
continue_on_error=False)
5153

mssql-scripter

100644100755
File mode changed.

mssqlscripter/main.py

+15-13
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,21 @@ def main(args):
101101
sys.stdout.write(line)
102102

103103
finally:
104-
105-
sql_tools_client.shutdown()
106-
tools_service_process.kill()
107-
# 1 second time out, allow tools service process to be killed.
108-
time.sleep(.1)
109-
# Close the stdout file handle or else we would get a resource warning (found via pytest).
110-
# This must be closed after the process is killed, otherwise we would block because the process is using
111-
# it's stdout.
112-
tools_service_process.stdout.close()
113-
# None value indicates process has not terminated.
114-
if not tools_service_process.poll():
115-
sys.stderr.write(
116-
u'Sql Tools Service process was not shut down properly.')
104+
if sql_tools_client:
105+
sql_tools_client.shutdown()
106+
107+
if tools_service_process:
108+
tools_service_process.kill()
109+
# 1 second time out, allow tools service process to be killed.
110+
time.sleep(.1)
111+
# Close the stdout file handle or else we would get a resource warning (found via pytest).
112+
# This must be closed after the process is killed, otherwise we would block because the process is using
113+
# it's stdout.
114+
tools_service_process.stdout.close()
115+
# None value indicates process has not terminated.
116+
if not tools_service_process.poll():
117+
sys.stderr.write(
118+
u'Sql Tools Service process was not shut down properly.')
117119
try:
118120
# Remove the temp file if we generated one.
119121
if temp_file_path:

mssqlscripter/mssqltoolsservice/external.py

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def copy_sqltoolsservice(platform):
3737
utility.clean_up(directory=TARGET_DIRECTORY)
3838

3939
if not platform or platform not in SUPPORTED_PLATFORMS:
40+
print('{} is not supported.'.format(platform))
4041
print('Please provide a valid platform flag.' +
4142
'[win32, win_amd64, win64, manylinux1_x86_64, manylinux1_i686, macosx_10_11_intel]')
4243
sys.exit(1)
Binary file not shown.
Binary file not shown.

utility.py

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
MSSQLSCRIPTER_DIST_DIRECTORY = os.path.abspath(
1616
os.path.join(os.path.abspath(__file__), '..', 'dist'))
1717

18+
MSSQLSCRIPTER_BUILD_DIRECTORY = os.path.abspath(
19+
os.path.join(os.path.abspath(__file__), '..', 'build'))
20+
1821

1922
def exec_command(command, directory, continue_on_error=True):
2023
"""

0 commit comments

Comments
 (0)