From 24a5dc8a5ed7e0a8093310c5aa88a0877bded37a Mon Sep 17 00:00:00 2001 From: Brian O'Neill Date: Thu, 17 Aug 2017 10:50:15 -0700 Subject: [PATCH 01/14] Use SqlToolsService built on .NET Core 2.0 and a build script updates (#131) * Bump version to 1.0.0a19 * Use .NET Core 2.0 RTM built sqltoolsservice * Add build script to upload to azure blob storage * Upgrade to VS 2017 * Remove 3.3 as supported Python version --- .bumpversion.cfg | 2 +- .travis.yml | 2 - appveyor.yml | 2 - build.py | 124 ++++++++++++++++++ dev_requirements.txt | 3 +- dev_setup.py | 8 +- mssqlscripter/__init__.py | 2 +- .../jsonrpc/contracts/tests/test_scripting.py | 2 +- mssqltoolsservice/buildwheels.py | 22 ++-- .../mssqltoolsservice/__init__.py | 4 +- mssqltoolsservice/setup.py | 2 +- setup.py | 7 +- sql-xplat-cli.pyproj | 23 ++-- sql-xplat-cli.sln | 7 +- utility.py | 10 ++ 15 files changed, 178 insertions(+), 42 deletions(-) create mode 100644 build.py diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 50835a7..0844c0b 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.0.0a18 +current_version = 1.0.0a19 parse = (?P\d+)\.(?P\d+)\.(?P\d+)((?P.*))(?P\d+) serialize = {major}.{minor}.{patch}{release}{release_version} diff --git a/.travis.yml b/.travis.yml index bafc37f..cd2f2a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,6 @@ matrix: env: TOXENV=py27 - os: linux python: "2.7" - - os: linux - python: "3.3" - os: linux python: "3.4" - os: linux diff --git a/appveyor.yml b/appveyor.yml index d07ec5d..3ae2e5f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,8 +3,6 @@ environment: matrix: - TOXENV: "py27" PYTHON: "C:\\Python27" - - TOXENV: "py33" - PYTHON: "C:\\Python33" - TOXENV: "py34" PYTHON: "C:\\Python34" - TOXENV: "py35" diff --git a/build.py b/build.py new file mode 100644 index 0000000..a03e814 --- /dev/null +++ b/build.py @@ -0,0 +1,124 @@ +#!/usr/bin/env python + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from __future__ import print_function +import os +import re +import sys +import tempfile +import utility +from azure.storage.blob import BlockBlobService, ContentSettings + +AZURE_STORAGE_CONNECTION_STRING = os.environ.get('AZURE_STORAGE_CONNECTION_STRING') +BLOB_CONTAINER_NAME = 'simple' +UPLOADED_PACKAGE_LINKS = [] + + +def print_heading(heading, f=None): + print('{0}\n{1}\n{0}'.format('=' * len(heading), heading), file=f) + + +def upload_index_file(service, blob_name, title, links): + print('Uploading index file {}'.format(blob_name)) + service.create_blob_from_text( + container_name=BLOB_CONTAINER_NAME, + blob_name=blob_name, + text="{0}

{0}

{1}" + .format(title, '\n'.join( + ['{0}
'.format(link) for link in links])), + content_settings=ContentSettings( + content_type='text/html', + content_disposition=None, + content_encoding=None, + content_language=None, + content_md5=None, + cache_control=None + ) + ) + + +def gen_pkg_index_html(service, pkg_name): + links = [] + index_file_name = pkg_name+'/' + for blob in list(service.list_blobs(BLOB_CONTAINER_NAME, prefix=index_file_name)): + if blob.name == index_file_name: + # Exclude the index file from being added to the list + continue + links.append(blob.name.replace(index_file_name, '')) + upload_index_file(service, index_file_name, 'Links for {}'.format(pkg_name), links) + UPLOADED_PACKAGE_LINKS.append(index_file_name) + + +def upload_package(service, file_path, pkg_name): + print('Uploading {}'.format(file_path)) + file_name = os.path.basename(file_path) + blob_name = '{}/{}'.format(pkg_name, file_name) + service.create_blob_from_path( + container_name=BLOB_CONTAINER_NAME, + blob_name=blob_name, + file_path=file_path + ) + gen_pkg_index_html(service, pkg_name) + + +def build(options): + + supported_actions = ['nightly'] + action = None + + if len(options) >= 1: + if options[0] not in supported_actions: + print('Please provide a supported action {}.'.format(supported_actions)) + return + action = options[0] + + if action == 'nightly': + assert AZURE_STORAGE_CONNECTION_STRING, 'Set AZURE_STORAGE_CONNECTION_STRING environment variable' + + print_heading('Cleanup') + + # clean + utility.clean_up(utility.MSSQLSCRIPTER_DIST_DIRECTORY) + utility.clean_up(utility.MSSQLTOOLSSERVICE_DIST_DIRECTORY) + utility.cleaun_up_egg_info_sub_directories(utility.ROOT_DIR) + utility.cleaun_up_egg_info_sub_directories(utility.MSSQLTOOLSSERVICE_DIRECTORY) + + print_heading('Running setup') + + # install general requirements. + utility.exec_command('pip install -r dev_requirements.txt', utility.ROOT_DIR) + + print_heading('Running mssql-scripter tests') + utility.exec_command('tox', utility.ROOT_DIR, continue_on_error = False) + + print_heading('Building mssql-scripter pip package') + utility.exec_command('python setup.py check -r -s sdist', utility.ROOT_DIR, continue_on_error = False) + + print_heading('Building mssqltoolsservice pip package') + utility.exec_command('python buildwheels.py', utility.MSSQLTOOLSSERVICE_DIRECTORY, continue_on_error = False) + + if action == 'nightly': + blob_service = BlockBlobService(connection_string=AZURE_STORAGE_CONNECTION_STRING) + + print_heading('Uploading packages to blob storage ') + for pkg in os.listdir(utility.MSSQLSCRIPTER_DIST_DIRECTORY): + pkg_path = os.path.join(utility.MSSQLSCRIPTER_DIST_DIRECTORY, pkg) + print('Uploading package {}'.format(pkg_path)) + upload_package(blob_service, pkg_path, 'mssql-scripter') + + for pkg in os.listdir(utility.MSSQLTOOLSSERVICE_DIST_DIRECTORY): + pkg_path = os.path.join(utility.MSSQLTOOLSSERVICE_DIST_DIRECTORY, pkg) + pkg_name = os.path.basename(pkg_path).split('-')[0].replace('_', '-').lower() + print('Uploading package {}'.format(pkg_name)) + upload_package(blob_service, pkg_path, pkg_name) + + # Upload the final index file + upload_index_file(blob_service, 'index.html', 'Simple Index', UPLOADED_PACKAGE_LINKS) + + +if __name__ == '__main__': + build(sys.argv[1:]) \ No newline at end of file diff --git a/dev_requirements.txt b/dev_requirements.txt index e370534..bb69fee 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -11,4 +11,5 @@ flake8 >= 3.3.0 pytest >= 3.0.7 pytest-cov >= 2.5.1 readme_renderer >= 17.2 -docutils >= 0.13.1 \ No newline at end of file +docutils >= 0.13.1 +azure-storage >= 0.33.0 \ No newline at end of file diff --git a/dev_setup.py b/dev_setup.py index 1f10eaf..ebbaccb 100644 --- a/dev_setup.py +++ b/dev_setup.py @@ -12,18 +12,16 @@ import setup import utility -root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) - print('Running dev setup...') -print('Root directory \'{}\'\n'.format(root_dir)) +print('Root directory \'{}\'\n'.format(utility.ROOT_DIR)) # install general requirements. -utility.exec_command('pip install -r dev_requirements.txt', root_dir) +utility.exec_command('pip install -r dev_requirements.txt', utility.ROOT_DIR) # install mssqltoolsservice if this platform supports it. mssqltoolsservice_package_name = os.environ['MSSQLTOOLSSERVICE_PACKAGE_NAME'] print('Installing {}...'.format(mssqltoolsservice_package_name)) # mssqltoolsservice package name is retrieved from environment variable set by setup.py. -utility.exec_command('pip install {}'.format(mssqltoolsservice_package_name), root_dir) +utility.exec_command('pip install {}'.format(mssqltoolsservice_package_name), utility.ROOT_DIR) print('Finished dev setup.') diff --git a/mssqlscripter/__init__.py b/mssqlscripter/__init__.py index 154b81d..fe92a3d 100644 --- a/mssqlscripter/__init__.py +++ b/mssqlscripter/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -__version__ = '1.0.0a18' +__version__ = '1.0.0a19' diff --git a/mssqlscripter/jsonrpc/contracts/tests/test_scripting.py b/mssqlscripter/jsonrpc/contracts/tests/test_scripting.py index 5ebfcd3..e66f19a 100644 --- a/mssqlscripter/jsonrpc/contracts/tests/test_scripting.py +++ b/mssqlscripter/jsonrpc/contracts/tests/test_scripting.py @@ -362,7 +362,7 @@ def generate_new_baseline(self, file_name): # Point sqltoolsservice output to file. with io.open(file_name, 'wb') as baseline: tools_service_process = subprocess.Popen( - 'D:\\GitHub\\sqltoolsservice\\src\\Microsoft.SqlTools.ServiceLayer\\bin\\Debug\\netcoreapp1.0\\win7-x64\\Microsoft.SqlTools.ServiceLayer.exe', + 'D:\\GitHub\\sqltoolsservice\\src\\Microsoft.SqlTools.ServiceLayer\\bin\\Debug\\netcoreapp2.0\\win7-x64\\MicrosoftSqlToolsServiceLayer.exe', bufsize=0, stdin=subprocess.PIPE, stdout=baseline) diff --git a/mssqltoolsservice/buildwheels.py b/mssqltoolsservice/buildwheels.py index c57f0ca..b02f215 100644 --- a/mssqltoolsservice/buildwheels.py +++ b/mssqltoolsservice/buildwheels.py @@ -17,20 +17,20 @@ from urllib.request import urlopen -DOWNLOAD_URL_BASE = 'https://mssqlscripter.blob.core.windows.net/sqltoolsservice-08-01-2017/' +DOWNLOAD_URL_BASE = 'https://mssqlscripter.blob.core.windows.net/sqltoolsservice-08-16-2017/' # Supported platform key's must match those in mssqlscript's setup.py. SUPPORTED_PLATFORMS = { - 'CentOS_7': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-centos-x64-netcoreapp1.0.tar.gz', - 'Debian_8': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-debian-x64-netcoreapp1.0.tar.gz', - 'Fedora_23': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-fedora-x64-netcoreapp1.0.tar.gz', - 'openSUSE_13_2': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-opensuse-x64-netcoreapp1.0.tar.gz', - 'OSX_10_11_64': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-osx-x64-netcoreapp1.0.tar.gz', - 'RHEL_7': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-rhel-x64-netcoreapp1.0.tar.gz', - 'Ubuntu_14': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-ubuntu14-x64-netcoreapp1.0.tar.gz', - 'Ubuntu_16': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-ubuntu16-x64-netcoreapp1.0.tar.gz', - 'Windows_7_64': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-win-x64-netcoreapp1.0.zip', - 'Windows_7_86': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-win-x86-netcoreapp1.0.zip', + 'CentOS_7': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-centos-x64-netcoreapp2.0.tar.gz', + 'Debian_8': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-debian-x64-netcoreapp2.0.tar.gz', + 'Fedora_23': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-fedora-x64-netcoreapp2.0.tar.gz', + 'openSUSE_13_2': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-opensuse-x64-netcoreapp2.0.tar.gz', + 'OSX_10_11_64': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-osx-x64-netcoreapp2.0.tar.gz', + 'RHEL_7': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-rhel-x64-netcoreapp2.0.tar.gz', + 'Ubuntu_14': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-ubuntu14-x64-netcoreapp2.0.tar.gz', + 'Ubuntu_16': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-ubuntu16-x64-netcoreapp2.0.tar.gz', + 'Windows_7_64': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-win-x64-netcoreapp2.0.zip', + 'Windows_7_86': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-win-x86-netcoreapp2.0.zip' } CURRENT_DIRECTORY = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) diff --git a/mssqltoolsservice/mssqltoolsservice/__init__.py b/mssqltoolsservice/mssqltoolsservice/__init__.py index d08039a..b8502f2 100644 --- a/mssqltoolsservice/mssqltoolsservice/__init__.py +++ b/mssqltoolsservice/mssqltoolsservice/__init__.py @@ -9,7 +9,7 @@ import os import platform -__version__ = '1.0.0a18' +__version__ = '1.0.0a19' def get_executable_path(): @@ -28,7 +28,7 @@ def get_executable_path(): 'bin')) # Format name based on platform. - mssqltoolsservice_name = u'Microsoft.SqlTools.ServiceLayer{}'.format( + mssqltoolsservice_name = u'MicrosoftSqlToolsServiceLayer{}'.format( u'.exe' if (platform.system() == u'Windows') else u'') mssqltoolsservice_full_path = os.path.abspath(os.path.join(mssqltoolsservice_base_path, mssqltoolsservice_name)) diff --git a/mssqltoolsservice/setup.py b/mssqltoolsservice/setup.py index 01fe5bb..38f23c4 100644 --- a/mssqltoolsservice/setup.py +++ b/mssqltoolsservice/setup.py @@ -12,7 +12,7 @@ # This version number is in place in two places and must be in sync with # mssqlscripter's version in setup.py. -MSSQLTOOLSSERVICE_VERSION = '1.0.0a18' +MSSQLTOOLSSERVICE_VERSION = '1.0.0a19' # If we have source, validate version numbers match to prevent # uploading releases with mismatched versions. diff --git a/setup.py b/setup.py index aa0874c..221ba90 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ # This version number is in place in two places and must be in sync with # mssqltoolsservice's version in setup.py. -MSSQLSCRIPTER_VERSION = '1.0.0a18' +MSSQLSCRIPTER_VERSION = '1.0.0a19' # If we have the source, validate our setup version matches source version. # This will prevent uploading releases with mismatched versions. This will @@ -56,7 +56,7 @@ toolsservice_version.group(1))) sys.exit(1) -MSSQLTOOLSSERVICE_PACKAGE_NAME = 'mssqltoolsservice_{}=={}' +MSSQLTOOLSSERVICE_PACKAGE_NAME = 'mssqltoolsservice-{}=={}' MSSQLTOOLSSERVICE_PACKAGE_SUFFIX = [ 'CentOS_7', 'Debian_8', @@ -204,7 +204,7 @@ def get_mssqltoolsservice_package_name(run_time_id=_get_runtime_id()): # set package suffix name for other uses like building wheels outside of setup.py. os.environ['MSSQLTOOLSSERVICE_PACKAGE_SUFFIX'] = run_time_id return MSSQLTOOLSSERVICE_PACKAGE_NAME.format( - run_time_id, MSSQLSCRIPTER_VERSION) + run_time_id, MSSQLSCRIPTER_VERSION).replace('_', '-').lower() raise EnvironmentError('mssqltoolsservice is not supported on this platform.') @@ -217,7 +217,6 @@ def get_mssqltoolsservice_package_name(run_time_id=_get_runtime_id()): 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', diff --git a/sql-xplat-cli.pyproj b/sql-xplat-cli.pyproj index dd14868..9d6e35e 100644 --- a/sql-xplat-cli.pyproj +++ b/sql-xplat-cli.pyproj @@ -5,15 +5,15 @@ 2.0 {f4bb6290-43f3-4f35-b26e-067c5ef8e64b} - mssqlscripter\main.py + build.py . . . {888888a0-9f3d-457c-b088-3a5042f75d52} Standard Python launcher - - - -S localhost -d AdventureWorks2014 + Global|PythonCore|2.7 + + False False @@ -21,11 +21,11 @@ 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets - + + @@ -43,13 +43,15 @@ - + + Code + @@ -87,6 +89,9 @@ - - + + + + + \ No newline at end of file diff --git a/sql-xplat-cli.sln b/sql-xplat-cli.sln index 97bcd3c..8051f79 100644 --- a/sql-xplat-cli.sln +++ b/sql-xplat-cli.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "sql-xplat-cli", "sql-xplat-cli.pyproj", "{F4BB6290-43F3-4F35-B26E-067C5EF8E64B}" EndProject @@ -17,4 +17,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1DD06426-BEB7-4299-B45E-04535B761301} + EndGlobalSection EndGlobal diff --git a/utility.py b/utility.py index 6b83242..0b8f10f 100644 --- a/utility.py +++ b/utility.py @@ -9,6 +9,10 @@ import shutil import sys +ROOT_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + +MSSQLTOOLSSERVICE_DIRECTORY = os.path.abspath(os.path.join( + os.path.abspath(__file__), '..', 'mssqltoolsservice')) MSSQLSCRIPTER_DIST_DIRECTORY = os.path.abspath( os.path.join(os.path.abspath(__file__), '..', 'dist')) @@ -32,6 +36,12 @@ def exec_command(command, directory, continue_on_error=True): pass +def cleaun_up_egg_info_sub_directories(directory): + for f in os.listdir(directory): + if f.endswith(".egg-info"): + clean_up(os.path.join(directory, f)) + + def clean_up(directory): """ Delete directory. From ae3c60ccd1048d15001da5bdec9eda5116486a93 Mon Sep 17 00:00:00 2001 From: Brian O'Neill Date: Thu, 17 Aug 2017 13:27:18 -0700 Subject: [PATCH 02/14] Fix perf issue where main event loop takes 100% of CPU (#132) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix perf issue where main event loop takes 100% of CPU We have a 2 threads: Thread #1 runs in a loop polling the response queue Thread #2 runs in a loop decoding responses from the sqltoolsservice over stdout and posting them to the response queue Since thread #1 doesn't sleep, it's takes 100% CPU. In addition, running python 2.7 on windows, #2 doesn’t preempt the CPU due to #1 taking all of the CPU cycles, so no response is processed. Fix is simple – thread #1 needs to sleep so thread #2 can get scheduled and get it’s work done. --- mssqlscripter/main.py | 3 ++- sql-xplat-cli.pyproj | 15 ++++----------- sql-xplat-cli.sln | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/mssqlscripter/main.py b/mssqlscripter/main.py index 333f4f7..4a0524d 100644 --- a/mssqlscripter/main.py +++ b/mssqlscripter/main.py @@ -86,8 +86,9 @@ def main(args): scripting_request.execute() while not scripting_request.completed(): + # The sleep prevents burning up the CPU and lets other threads get scheduled. + time.sleep(0.1) response = scripting_request.get_response() - if response: scriptercallbacks.handle_response(response, parameters.DisplayProgress) diff --git a/sql-xplat-cli.pyproj b/sql-xplat-cli.pyproj index 9d6e35e..9c31b76 100644 --- a/sql-xplat-cli.pyproj +++ b/sql-xplat-cli.pyproj @@ -5,15 +5,13 @@ 2.0 {f4bb6290-43f3-4f35-b26e-067c5ef8e64b} - build.py + mssqlscripter\main.py . . . {888888a0-9f3d-457c-b088-3a5042f75d52} Standard Python launcher - Global|PythonCore|2.7 - - + -S localhost -d AdventureWorks2014 False False @@ -26,6 +24,7 @@ + @@ -49,9 +48,7 @@ - - Code - + @@ -89,9 +86,5 @@ - - - - \ No newline at end of file diff --git a/sql-xplat-cli.sln b/sql-xplat-cli.sln index 8051f79..7095fd2 100644 --- a/sql-xplat-cli.sln +++ b/sql-xplat-cli.sln @@ -18,6 +18,6 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {1DD06426-BEB7-4299-B45E-04535B761301} + SolutionGuid = {1A0F24BB-2803-4A8C-9816-CB374FAAC673} EndGlobalSection EndGlobal From d7ef5f27c776ed386fe516e59ca8d483835c46a6 Mon Sep 17 00:00:00 2001 From: Brian O'Neill Date: Thu, 17 Aug 2017 16:25:59 -0700 Subject: [PATCH 03/14] Refine event loop perf fix in main.py Refine event loop perf fix in main.py --- mssqlscripter/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mssqlscripter/main.py b/mssqlscripter/main.py index 4a0524d..7bed0b5 100644 --- a/mssqlscripter/main.py +++ b/mssqlscripter/main.py @@ -86,11 +86,12 @@ def main(args): scripting_request.execute() while not scripting_request.completed(): - # The sleep prevents burning up the CPU and lets other threads get scheduled. - time.sleep(0.1) response = scripting_request.get_response() if response: scriptercallbacks.handle_response(response, parameters.DisplayProgress) + else: + # The sleep prevents burning up the CPU and lets other threads get scheduled. + time.sleep(0.1) # Only write to stdout if user did not provide a file path. logger.info('stdout current encoding: {}'.format(sys.stdout.encoding)) From a7f932056f153c15a3d8b1057216df86f38c1850 Mon Sep 17 00:00:00 2001 From: Ronald Quan Date: Wed, 23 Aug 2017 10:25:00 -0700 Subject: [PATCH 04/14] Fixing regular expression Previous regex would result in release:a1 and release_version: 12. Modified the regex for part Release to only pick up lower case letters. --- .bumpversion.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 0844c0b..fde302a 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,6 +1,6 @@ [bumpversion] current_version = 1.0.0a19 -parse = (?P\d+)\.(?P\d+)\.(?P\d+)((?P.*))(?P\d+) +parse = (?P\d+)\.(?P\d+)\.(?P\d+)((?P[a-z]+))(?P\d+) serialize = {major}.{minor}.{patch}{release}{release_version} From b59f717106910dec7ced29ae0acc2645ab7d9af9 Mon Sep 17 00:00:00 2001 From: Ronald Quan Date: Wed, 23 Aug 2017 10:33:13 -0700 Subject: [PATCH 05/14] Adding missing forward slash on test pypi url --- doc/pypi_release_steps.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/pypi_release_steps.md b/doc/pypi_release_steps.md index c363a77..655dc18 100644 --- a/doc/pypi_release_steps.md +++ b/doc/pypi_release_steps.md @@ -86,7 +86,7 @@ bumpversion release_version  -> 1.0.0a1     pypitest   [pypitest] - repository = https://test.pypi.org/legacy + repository = https://test.pypi.org/legacy/ username = your_username password = your_password ``` From abb0809513a4e6e0f2de5d12339e7540b891dd7a Mon Sep 17 00:00:00 2001 From: captain numerica Date: Tue, 29 Aug 2017 11:06:58 -0700 Subject: [PATCH 06/14] fixing typos/grammar (#138) fixing typos/grammar. --- doc/installation_guide.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/installation_guide.md b/doc/installation_guide.md index d824b16..68de693 100644 --- a/doc/installation_guide.md +++ b/doc/installation_guide.md @@ -1,7 +1,7 @@ # Installation Guide ## Quick Start -mssql-scritper is installed via pip. If you know pip, you can install mssql-scripter using command +mssql-scripter is installed via pip. If you know pip, you can install mssql-scripter using command ```shell $ pip install mssql-scripter ``` @@ -70,7 +70,7 @@ $ sudo apt-get install python-pip $ sudo pip install --upgrade pip ``` -Install mssql-scritper using command: +Install mssql-scripter using command: ```shell $ sudo pip install mssql-scripter @@ -103,7 +103,7 @@ More information can be found at: - [Development guide](development_guide.md#Environment_Setup) -## Error: Could not find version that satifies the requirement mssql-scripter +## Error: Could not find version that satisfies the requirement mssql-scripter If you see the above error running `pip install mssql-scripter`, this means the pip version used is out-of-date. Upgrade pip using the command: ```shell $ sudo apt-get install python-pip @@ -141,7 +141,7 @@ $ sudo apt-get install libunwind8 ``` ### Debian 8 -The file `/etc/apt/sources.list' needs to updated with the following line +The file `/etc/apt/sources.list' needs to be updated with the following line ``` deb http://ftp.us.debian.org/debian/ jessie main ``` From 562bcda51c026b1b3fc94f3c3fdd4c26ab95303c Mon Sep 17 00:00:00 2001 From: Ronald Quan Date: Fri, 1 Sep 2017 18:28:26 -0400 Subject: [PATCH 07/14] Updating to release version 1.0.0a20. --- .bumpversion.cfg | 2 +- mssqlscripter/__init__.py | 2 +- mssqltoolsservice/mssqltoolsservice/__init__.py | 2 +- mssqltoolsservice/setup.py | 2 +- setup.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index fde302a..1dfe152 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.0.0a19 +current_version = 1.0.0a20 parse = (?P\d+)\.(?P\d+)\.(?P\d+)((?P[a-z]+))(?P\d+) serialize = {major}.{minor}.{patch}{release}{release_version} diff --git a/mssqlscripter/__init__.py b/mssqlscripter/__init__.py index fe92a3d..d9c4452 100644 --- a/mssqlscripter/__init__.py +++ b/mssqlscripter/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -__version__ = '1.0.0a19' +__version__ = '1.0.0a20' diff --git a/mssqltoolsservice/mssqltoolsservice/__init__.py b/mssqltoolsservice/mssqltoolsservice/__init__.py index b8502f2..659056a 100644 --- a/mssqltoolsservice/mssqltoolsservice/__init__.py +++ b/mssqltoolsservice/mssqltoolsservice/__init__.py @@ -9,7 +9,7 @@ import os import platform -__version__ = '1.0.0a19' +__version__ = '1.0.0a20' def get_executable_path(): diff --git a/mssqltoolsservice/setup.py b/mssqltoolsservice/setup.py index 38f23c4..bb0bd22 100644 --- a/mssqltoolsservice/setup.py +++ b/mssqltoolsservice/setup.py @@ -12,7 +12,7 @@ # This version number is in place in two places and must be in sync with # mssqlscripter's version in setup.py. -MSSQLTOOLSSERVICE_VERSION = '1.0.0a19' +MSSQLTOOLSSERVICE_VERSION = '1.0.0a20' # If we have source, validate version numbers match to prevent # uploading releases with mismatched versions. diff --git a/setup.py b/setup.py index 221ba90..ffb2f01 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ # This version number is in place in two places and must be in sync with # mssqltoolsservice's version in setup.py. -MSSQLSCRIPTER_VERSION = '1.0.0a19' +MSSQLSCRIPTER_VERSION = '1.0.0a20' # If we have the source, validate our setup version matches source version. # This will prevent uploading releases with mismatched versions. This will From a5ea17078837067ae10498b6bdf6355da03bb546 Mon Sep 17 00:00:00 2001 From: Tara Raj Date: Thu, 7 Sep 2017 13:08:54 -0700 Subject: [PATCH 08/14] Create doc for official msft docs page --- doc/documentation_page.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/documentation_page.md diff --git a/doc/documentation_page.md b/doc/documentation_page.md new file mode 100644 index 0000000..5b733f0 --- /dev/null +++ b/doc/documentation_page.md @@ -0,0 +1 @@ +#Get Started with mssql-scripter From 3e9097b69327442e90669d27775103a9be207603 Mon Sep 17 00:00:00 2001 From: Tara Raj Date: Thu, 7 Sep 2017 13:17:44 -0700 Subject: [PATCH 09/14] Updated documentation page with usage_guide --- doc/documentation_page.md | 79 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/doc/documentation_page.md b/doc/documentation_page.md index 5b733f0..235221d 100644 --- a/doc/documentation_page.md +++ b/doc/documentation_page.md @@ -1 +1,78 @@ -#Get Started with mssql-scripter +# Get Started with mssql-scripter + +mssql-scripter is the multiplatform command line equivalent of the widely used Generate Scripts Wizard experience in SSMS. + +You can use mssql-scripter on Linux, macOS, and Windows to generate data definition language (DDL) and data manipulation language (DML) T-SQL scripts for database objects in SQL Server running anywhere, Azure SQL Database, and Azure SQL Data Warehouse. You can save the generated T-SQL script to a .sql file or pipe it to standard *nix utilities (for example, sed, awk, grep) for further transformations. You can edit the generated script or check it into source control and subsequently execute the script in your existing SQL database deployment processes and DevOps pipelines with standard multiplatform SQL command line tools such as sqlcmd. + +## Install + +For information about installation, please see the LINK/install guide/LINK. + +## Dump database object schema + + # generate DDL scripts for all objects in the Adventureworks database and save the script to a file + mssql-scripter -S localhost -d AdventureWorks -U sa + + # alternatively, specify the schema only flag to generate DDL scripts for all objects in the Adventureworks database and save the script to a file + mssql-scripter -S localhost -d AdventureWorks -U sa -f ./adventureworks.sql + +## Dump database object data + + # generate DDL scripts for all objects in the Adventureworks database and save the script to stdout. + mssql-scripter -S localhost -d AdventureWorks -U sa --data-only + +## Dump the database object schema and data + + # script the database schema and data piped to a file. + mssql-scripter -S localhost -d AdventureWorks -U sa --schema-and-data > ./adventureworks.sql + + # execute the generated above script with sqlcmd + sqlcmd -S mytestserver -U sa -i ./adventureworks.sql + +## Include database objects + + # generate DDL scripts for objects that contain 'Employee' in their name to stdout + mssql-scripter -S localhost -d AdventureWorks -U sa --include-objects Employee + + # generate DDL scripts for the dbo schema and pipe the output to a file + mssql-scripter -S localhost -d AdventureWorks -U sa --include-objects dbo. > ./dboschema.sql + +## Exclude database objects + + # generate DDL scripts for objects that do not contain 'Sale' in their name to stdout + mssql-scripter -S localhost -d AdventureWorks -U sa --exclude-objects Sale + +## Target server version + + # specify the version of SQL Server the script will be run against + mssql-scripter -S myServer -d AdventureWorks -U myUser –-target-server-version "AzureDB" > myData.sql + +## Target server edition + + # specify the edition of SQL Server the script will be run against + mssql-scripter -S localhost -d AdventureWorks -U myUser –-target-server-edition "Enterprise" > myData.sql + +## Pipe a generated script to sed +Note this example is for Linux and macOS usage. + + # change a schema name in the generated DDL script + # 1) generate DDL scripts for all objects in the Adventureworks database + # 2) pipe generated script to sed and change all occurrences of SalesLT to SalesLT_test and save the script to a file + $ mssql-scripter -S localhost -d Adventureworks -U sa | sed -e "s/SalesLT./SalesLT_test./g" > adventureworks_SalesLT_test.sql + +## Script data to a file + + # script all the data to a file. + mssql-scripter -S localhost -d AdventureWorks -U sa --data-only > ./adventureworks-data.sql + +## Set environment variables +You can set environment variables for your connection string through the following steps: + + + # set environment variable MSSQL_SCRIPTER_CONNECTION_STRING with a connection string. + $ export MSSQL_SCRIPTER_CONNECTION_STRING='Server=myserver;Database=mydb;User Id=myuser;Password=mypassword;' + $ mssql-scripter + + # set environment variable MSSQL_SCRIPTER_PASSWORD so no password input is required. + $ export MSSQL_SCRIPTER_PASSWORD='ABC123' + $ mssql-scripter -S localhost -d AdventureWorks -U sa From 697e83fe2454c34f947e0683de9ca1d2a5035167 Mon Sep 17 00:00:00 2001 From: Tara Raj Date: Thu, 7 Sep 2017 13:21:32 -0700 Subject: [PATCH 10/14] Added link to download adventureworks --- doc/documentation_page.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/documentation_page.md b/doc/documentation_page.md index 235221d..cc43728 100644 --- a/doc/documentation_page.md +++ b/doc/documentation_page.md @@ -8,6 +8,8 @@ You can use mssql-scripter on Linux, macOS, and Windows to generate data definit For information about installation, please see the LINK/install guide/LINK. +The examples in this guide use the Adventureworks sample database. You can download the sample [here](https://www.microsoft.com/en-us/download/details.aspx?id=49502). + ## Dump database object schema # generate DDL scripts for all objects in the Adventureworks database and save the script to a file From 1fbbd9cb71c94f11ebd74a3e59a1b55827c8e3db Mon Sep 17 00:00:00 2001 From: Tara Raj Date: Thu, 7 Sep 2017 13:31:37 -0700 Subject: [PATCH 11/14] Updated with sqlcmd usage --- doc/documentation_page.md | 42 +++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/doc/documentation_page.md b/doc/documentation_page.md index cc43728..5584e67 100644 --- a/doc/documentation_page.md +++ b/doc/documentation_page.md @@ -10,7 +10,10 @@ For information about installation, please see the LINK/install guide/LINK. The examples in this guide use the Adventureworks sample database. You can download the sample [here](https://www.microsoft.com/en-us/download/details.aspx?id=49502). -## Dump database object schema +## Generate scripts +Use mssql-scripter to generate scripts for database schema and/or data by including specific objects, targeting server versions/editions, and piping the script to files. + +### Dump database object schema # generate DDL scripts for all objects in the Adventureworks database and save the script to a file mssql-scripter -S localhost -d AdventureWorks -U sa @@ -18,12 +21,12 @@ The examples in this guide use the Adventureworks sample database. You can downl # alternatively, specify the schema only flag to generate DDL scripts for all objects in the Adventureworks database and save the script to a file mssql-scripter -S localhost -d AdventureWorks -U sa -f ./adventureworks.sql -## Dump database object data +### Dump database object data # generate DDL scripts for all objects in the Adventureworks database and save the script to stdout. mssql-scripter -S localhost -d AdventureWorks -U sa --data-only -## Dump the database object schema and data +### Dump the database object schema and data # script the database schema and data piped to a file. mssql-scripter -S localhost -d AdventureWorks -U sa --schema-and-data > ./adventureworks.sql @@ -31,7 +34,7 @@ The examples in this guide use the Adventureworks sample database. You can downl # execute the generated above script with sqlcmd sqlcmd -S mytestserver -U sa -i ./adventureworks.sql -## Include database objects +### Include database objects # generate DDL scripts for objects that contain 'Employee' in their name to stdout mssql-scripter -S localhost -d AdventureWorks -U sa --include-objects Employee @@ -39,42 +42,51 @@ The examples in this guide use the Adventureworks sample database. You can downl # generate DDL scripts for the dbo schema and pipe the output to a file mssql-scripter -S localhost -d AdventureWorks -U sa --include-objects dbo. > ./dboschema.sql -## Exclude database objects +### Exclude database objects # generate DDL scripts for objects that do not contain 'Sale' in their name to stdout mssql-scripter -S localhost -d AdventureWorks -U sa --exclude-objects Sale -## Target server version +### Target server version # specify the version of SQL Server the script will be run against mssql-scripter -S myServer -d AdventureWorks -U myUser –-target-server-version "AzureDB" > myData.sql -## Target server edition +### Target server edition # specify the edition of SQL Server the script will be run against mssql-scripter -S localhost -d AdventureWorks -U myUser –-target-server-edition "Enterprise" > myData.sql -## Pipe a generated script to sed +### Pipe a generated script to sed Note this example is for Linux and macOS usage. # change a schema name in the generated DDL script # 1) generate DDL scripts for all objects in the Adventureworks database # 2) pipe generated script to sed and change all occurrences of SalesLT to SalesLT_test and save the script to a file - $ mssql-scripter -S localhost -d Adventureworks -U sa | sed -e "s/SalesLT./SalesLT_test./g" > adventureworks_SalesLT_test.sql + mssql-scripter -S localhost -d Adventureworks -U sa | sed -e "s/SalesLT./SalesLT_test./g" > adventureworks_SalesLT_test.sql -## Script data to a file +### Script data to a file # script all the data to a file. mssql-scripter -S localhost -d AdventureWorks -U sa --data-only > ./adventureworks-data.sql -## Set environment variables +### Set environment variables You can set environment variables for your connection string through the following steps: # set environment variable MSSQL_SCRIPTER_CONNECTION_STRING with a connection string. - $ export MSSQL_SCRIPTER_CONNECTION_STRING='Server=myserver;Database=mydb;User Id=myuser;Password=mypassword;' - $ mssql-scripter + export MSSQL_SCRIPTER_CONNECTION_STRING='Server=myserver;Database=mydb;User Id=myuser;Password=mypassword;' + mssql-scripter # set environment variable MSSQL_SCRIPTER_PASSWORD so no password input is required. - $ export MSSQL_SCRIPTER_PASSWORD='ABC123' - $ mssql-scripter -S localhost -d AdventureWorks -U sa + export MSSQL_SCRIPTER_PASSWORD='ABC123' + mssql-scripter -S localhost -d AdventureWorks -U sa + + ## Run your scripts using sqlcmd + Now that you have generated a script for your database objects, you can execute the script using sqlcmd such as in the example below. + + # script all the data to a file. + mssql-scripter -S localhost -d AdventureWorks -U sa --data-only > ./adventureworks-data.sql + sqlcmd -S localhost -d AdventureWorks -U sa -i`./adventureworks-data.sql + + You can find more details on using sqlcmd [here](https://docs.microsoft.com/en-us/sql/relational-databases/scripting/sqlcmd-use-the-utility). From 6bf25d80c4d0706895a8770d2975637a87f253d0 Mon Sep 17 00:00:00 2001 From: Tara Raj Date: Thu, 7 Sep 2017 13:41:02 -0700 Subject: [PATCH 12/14] Added in run and cloud shell support --- doc/documentation_page.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/doc/documentation_page.md b/doc/documentation_page.md index 5584e67..5d93df3 100644 --- a/doc/documentation_page.md +++ b/doc/documentation_page.md @@ -1,8 +1,8 @@ # Get Started with mssql-scripter -mssql-scripter is the multiplatform command line equivalent of the widely used Generate Scripts Wizard experience in SSMS. +mssql-scripter is the command line equivalent of the widely used Generate Scripts Wizard experience in SSMS. -You can use mssql-scripter on Linux, macOS, and Windows to generate data definition language (DDL) and data manipulation language (DML) T-SQL scripts for database objects in SQL Server running anywhere, Azure SQL Database, and Azure SQL Data Warehouse. You can save the generated T-SQL script to a .sql file or pipe it to standard *nix utilities (for example, sed, awk, grep) for further transformations. You can edit the generated script or check it into source control and subsequently execute the script in your existing SQL database deployment processes and DevOps pipelines with standard multiplatform SQL command line tools such as sqlcmd. +You can use mssql-scripter on Linux, macOS, Windows, and the Azure Cloud Shell to generate data definition language (DDL) and data manipulation language (DML) T-SQL scripts for database objects in SQL Server running anywhere, Azure SQL Database, and Azure SQL Data Warehouse. You can save the generated T-SQL script to a .sql file or pipe it to standard *nix utilities (for example, sed, awk, grep) for further transformations. You can edit the generated script or check it into source control and subsequently execute the script in your existing SQL database deployment processes and DevOps pipelines with standard multiplatform SQL command line tools such as sqlcmd. ## Install @@ -82,11 +82,19 @@ You can set environment variables for your connection string through the followi export MSSQL_SCRIPTER_PASSWORD='ABC123' mssql-scripter -S localhost -d AdventureWorks -U sa - ## Run your scripts using sqlcmd - Now that you have generated a script for your database objects, you can execute the script using sqlcmd such as in the example below. + ## Generate and run scripts + In this example you will generate a script, send it to a file, and execute the script. + Generate a script and send it to a file using mssql-scripter. # script all the data to a file. mssql-scripter -S localhost -d AdventureWorks -U sa --data-only > ./adventureworks-data.sql + + Now that you have generated a script for your database objects, you can execute the script using sqlcmd such as in the example below. + + # execute the script from the file. sqlcmd -S localhost -d AdventureWorks -U sa -i`./adventureworks-data.sql You can find more details on using sqlcmd [here](https://docs.microsoft.com/en-us/sql/relational-databases/scripting/sqlcmd-use-the-utility). + +## Use mssql-scripter in the Cloud Shell +You can use mssql-scripter in the Azure Cloud Shell to generate scripter for Azure SQL DB, Azure SQL DW, and SQL Server instances in Azure VMs. [Connect to the Azure Cloud Shell](https://docs.microsoft.com/en-us/azure/cloud-shell/overview?view=azure-cli-latest). Once connected, you can use mssql-scripter in the terminal as you would in a local terminal. From 5d1927e5e4693b0dce0415bfa522ba0c89439b6c Mon Sep 17 00:00:00 2001 From: Ronald Quan Date: Thu, 12 Oct 2017 17:57:27 -0700 Subject: [PATCH 13/14] Update/consolidate linux install (#153) * universal linux wheel gen and setup update. * Updating version cfg. * Updating sqltoolsservice container. * Updating spacing for flake8. --- .bumpversion.cfg | 2 +- mssqlscripter/__init__.py | 2 +- mssqltoolsservice/buildwheels.py | 17 +-- .../mssqltoolsservice/__init__.py | 2 +- mssqltoolsservice/setup.py | 2 +- setup.py | 115 +----------------- 6 files changed, 14 insertions(+), 126 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 1dfe152..a1bfef7 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.0.0a20 +current_version = 1.0.0a21 parse = (?P\d+)\.(?P\d+)\.(?P\d+)((?P[a-z]+))(?P\d+) serialize = {major}.{minor}.{patch}{release}{release_version} diff --git a/mssqlscripter/__init__.py b/mssqlscripter/__init__.py index d9c4452..fcbf477 100644 --- a/mssqlscripter/__init__.py +++ b/mssqlscripter/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -__version__ = '1.0.0a20' +__version__ = '1.0.0a21' diff --git a/mssqltoolsservice/buildwheels.py b/mssqltoolsservice/buildwheels.py index b02f215..9f3d986 100644 --- a/mssqltoolsservice/buildwheels.py +++ b/mssqltoolsservice/buildwheels.py @@ -17,20 +17,14 @@ from urllib.request import urlopen -DOWNLOAD_URL_BASE = 'https://mssqlscripter.blob.core.windows.net/sqltoolsservice-08-16-2017/' +DOWNLOAD_URL_BASE = 'https://mssqlscripter.blob.core.windows.net/sqltoolsservice-10-12-2017/' # Supported platform key's must match those in mssqlscript's setup.py. SUPPORTED_PLATFORMS = { - 'CentOS_7': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-centos-x64-netcoreapp2.0.tar.gz', - 'Debian_8': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-debian-x64-netcoreapp2.0.tar.gz', - 'Fedora_23': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-fedora-x64-netcoreapp2.0.tar.gz', - 'openSUSE_13_2': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-opensuse-x64-netcoreapp2.0.tar.gz', - 'OSX_10_11_64': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-osx-x64-netcoreapp2.0.tar.gz', - 'RHEL_7': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-rhel-x64-netcoreapp2.0.tar.gz', - 'Ubuntu_14': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-ubuntu14-x64-netcoreapp2.0.tar.gz', - 'Ubuntu_16': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-ubuntu16-x64-netcoreapp2.0.tar.gz', - 'Windows_7_64': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-win-x64-netcoreapp2.0.zip', - 'Windows_7_86': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-win-x86-netcoreapp2.0.zip' + 'Linux_64': DOWNLOAD_URL_BASE + 'Microsoft.SqlTools.ServiceLayer-linux-x64-netcoreapp2.0.tar.gz', + 'OSX_10_11_64': DOWNLOAD_URL_BASE + 'Microsoft.SqlTools.ServiceLayer-osx-x64-netcoreapp2.0.tar.gz', + 'Windows_7_64': DOWNLOAD_URL_BASE + 'Microsoft.SqlTools.ServiceLayer-win-x64-netcoreapp2.0.zip', + 'Windows_7_86': DOWNLOAD_URL_BASE + 'Microsoft.SqlTools.ServiceLayer-win-x86-netcoreapp2.0.zip' } CURRENT_DIRECTORY = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) @@ -78,6 +72,7 @@ def build_sqltoolsservice_wheels(platforms): os.environ[u'MSSQLTOOLSSERVICE_PLATFORM'] = platform print(u'Calling setup bdist_wheel for platform:{}'.format(platform)) + print(SUPPORTED_PLATFORMS[platform]) download_and_unzip(SUPPORTED_PLATFORMS[platform], directory=TARGET_DIRECTORY) utility.exec_command(u'python setup.py check -r -s bdist_wheel', CURRENT_DIRECTORY) diff --git a/mssqltoolsservice/mssqltoolsservice/__init__.py b/mssqltoolsservice/mssqltoolsservice/__init__.py index 659056a..53fb8bc 100644 --- a/mssqltoolsservice/mssqltoolsservice/__init__.py +++ b/mssqltoolsservice/mssqltoolsservice/__init__.py @@ -9,7 +9,7 @@ import os import platform -__version__ = '1.0.0a20' +__version__ = '1.0.0a21' def get_executable_path(): diff --git a/mssqltoolsservice/setup.py b/mssqltoolsservice/setup.py index bb0bd22..5a78e3a 100644 --- a/mssqltoolsservice/setup.py +++ b/mssqltoolsservice/setup.py @@ -12,7 +12,7 @@ # This version number is in place in two places and must be in sync with # mssqlscripter's version in setup.py. -MSSQLTOOLSSERVICE_VERSION = '1.0.0a20' +MSSQLTOOLSSERVICE_VERSION = '1.0.0a21' # If we have source, validate version numbers match to prevent # uploading releases with mismatched versions. diff --git a/setup.py b/setup.py index ffb2f01..8e98f02 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ # This version number is in place in two places and must be in sync with # mssqltoolsservice's version in setup.py. -MSSQLSCRIPTER_VERSION = '1.0.0a20' +MSSQLSCRIPTER_VERSION = '1.0.0a21' # If we have the source, validate our setup version matches source version. # This will prevent uploading releases with mismatched versions. This will @@ -58,119 +58,12 @@ MSSQLTOOLSSERVICE_PACKAGE_NAME = 'mssqltoolsservice-{}=={}' MSSQLTOOLSSERVICE_PACKAGE_SUFFIX = [ - 'CentOS_7', - 'Debian_8', - 'Fedora_23', - 'openSUSE_13_2', 'OSX_10_11_64', - 'RHEL_7', - 'Ubuntu_14', - 'Ubuntu_16', 'Windows_7_64', - 'Windows_7_86' + 'Windows_7_86', + 'Linux_64' ] -LINUX_DISTRO_NO_VERSION = { - 'centos': 'CentOS_7', - 'ol': 'CentOS_7', - 'fedora': 'Fedora_23', - 'opensuse': 'OpenSUSE_13_2', - 'rhel': 'RHEL_7', - 'debian': 'Debian_8', -} - -LINUX_DISTRO_WITH_VERSION = { - 'ubuntu': - { - '14': 'Ubuntu_14', - '16': 'Ubuntu_16' - }, - 'elementary': - { - '0.3': 'Ubuntu_14', - '0.4': 'Ubuntu_16' - }, - 'elementaryOS': - { - '0.3': 'Ubuntu_14', - '0.4': 'Ubuntu_16' - }, - 'linuxmint': - { - '18': 'Ubuntu_16' - }, - 'galliumos': - { - '2.0': 'Ubuntu_16' - }, -} - - -def _get_runtime_id_helper(name, version): - """ - Checks if linux distro name and version match to a supported package. - """ - if name in LINUX_DISTRO_NO_VERSION: - return LINUX_DISTRO_NO_VERSION[name] - - if name in LINUX_DISTRO_WITH_VERSION: - for supported_version in LINUX_DISTRO_WITH_VERSION[name]: - if version.startswith(supported_version): - return LINUX_DISTRO_WITH_VERSION[name][supported_version] - return None - - -def _get_linux_distro_runtime_id(content): - """ - Parse content for linux distro run time id. - """ - name = None - version = None - id_like = None - - # Try to find name, version and id_like best effort. - for line in content.splitlines(): - key, value = line.rstrip().split('=') - value = value.strip('"') - if key == 'ID': - name = value - elif key == 'VERSION_ID': - version = value - elif key == 'ID_LIKE': - id_like = value.split(' ') - if name and version and id_like: - break - # First try the distribution name. - run_time_id = _get_runtime_id_helper(name, version) - - # If we don't understand it, try the 'ID_LIKE' field. - if not run_time_id and id_like: - for name in id_like: - run_time_id = _get_runtime_id_helper(name, version) - if run_time_id: - break - - return run_time_id - - -def _get_linux_distro_from_file(): - """ - Find linux distro based on - https://www.freedesktop.org/software/systemd/man/os-release.html. - """ - os_release_info_file = None - - if os.path.exists('/etc/os-release'): - os_release_info_file = '/etc/os-release' - elif os.path.exists('/usr/lib/os-release'): - os_release_info_file = '/usr/lib/os-release' - else: - raise EnvironmentError('Error detecting Linux distro version.') - - with io.open(os_release_info_file, 'r', encoding='utf-8') as os_release_file: - content = os_release_file.read() - return _get_linux_distro_runtime_id(content) - def _get_runtime_id( system=_platform.system(), @@ -191,7 +84,7 @@ def _get_runtime_id( run_time_id = 'OSX_10_11_64' elif system == 'Linux': if architecture == '64bit': - run_time_id = _get_linux_distro_from_file() + run_time_id = 'Linux_64' return run_time_id From 416b19d8828f1d0e95c7850226f993fa6f207d35 Mon Sep 17 00:00:00 2001 From: Ronald Quan Date: Fri, 13 Oct 2017 14:24:05 -0700 Subject: [PATCH 14/14] Updating team email. (#154) --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8e98f02..eb05f97 100644 --- a/setup.py +++ b/setup.py @@ -137,7 +137,7 @@ def get_mssqltoolsservice_package_name(run_time_id=_get_runtime_id()): description='Microsoft SQL Scripter Command-Line Tool', license='MIT', author='Microsoft Corporation', - author_email='sqlxplatclieng@microsoft.com', + author_email='sqlcli@microsoft.com', url='https://github.com/Microsoft/sql-xplat-cli/', zip_safe=True, long_description=open('README.rst').read(),