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

Commit ad37035

Browse files
authored
Merging dev to master for release 1.0.0a20 (#141)
* 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 * Fix perf issue where main event loop takes 100% of CPU (#132) 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. * Refine event loop perf fix in main.py Refine event loop perf fix in main.py * 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. * Adding missing forward slash on test pypi url * fixing typos/grammar (#138) fixing typos/grammar. * Updating to release version 1.0.0a20.
1 parent 0717f08 commit ad37035

File tree

18 files changed

+177
-46
lines changed

18 files changed

+177
-46
lines changed

.bumpversion.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[bumpversion]
2-
current_version = 1.0.0a18
3-
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((?P<release>.*))(?P<release_version>\d+)
2+
current_version = 1.0.0a20
3+
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}
66

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ matrix:
1010
env: TOXENV=py27
1111
- os: linux
1212
python: "2.7"
13-
- os: linux
14-
python: "3.3"
1513
- os: linux
1614
python: "3.4"
1715
- os: linux

appveyor.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ environment:
33
matrix:
44
- TOXENV: "py27"
55
PYTHON: "C:\\Python27"
6-
- TOXENV: "py33"
7-
PYTHON: "C:\\Python33"
86
- TOXENV: "py34"
97
PYTHON: "C:\\Python34"
108
- TOXENV: "py35"

build.py

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#!/usr/bin/env python
2+
3+
# --------------------------------------------------------------------------------------------
4+
# Copyright (c) Microsoft Corporation. All rights reserved.
5+
# Licensed under the MIT License. See License.txt in the project root for license information.
6+
# --------------------------------------------------------------------------------------------
7+
8+
from __future__ import print_function
9+
import os
10+
import re
11+
import sys
12+
import tempfile
13+
import utility
14+
from azure.storage.blob import BlockBlobService, ContentSettings
15+
16+
AZURE_STORAGE_CONNECTION_STRING = os.environ.get('AZURE_STORAGE_CONNECTION_STRING')
17+
BLOB_CONTAINER_NAME = 'simple'
18+
UPLOADED_PACKAGE_LINKS = []
19+
20+
21+
def print_heading(heading, f=None):
22+
print('{0}\n{1}\n{0}'.format('=' * len(heading), heading), file=f)
23+
24+
25+
def upload_index_file(service, blob_name, title, links):
26+
print('Uploading index file {}'.format(blob_name))
27+
service.create_blob_from_text(
28+
container_name=BLOB_CONTAINER_NAME,
29+
blob_name=blob_name,
30+
text="<html><head><title>{0}</title></head><body><h1>{0}</h1>{1}</body></html>"
31+
.format(title, '\n'.join(
32+
['<a href="{0}">{0}</a><br/>'.format(link) for link in links])),
33+
content_settings=ContentSettings(
34+
content_type='text/html',
35+
content_disposition=None,
36+
content_encoding=None,
37+
content_language=None,
38+
content_md5=None,
39+
cache_control=None
40+
)
41+
)
42+
43+
44+
def gen_pkg_index_html(service, pkg_name):
45+
links = []
46+
index_file_name = pkg_name+'/'
47+
for blob in list(service.list_blobs(BLOB_CONTAINER_NAME, prefix=index_file_name)):
48+
if blob.name == index_file_name:
49+
# Exclude the index file from being added to the list
50+
continue
51+
links.append(blob.name.replace(index_file_name, ''))
52+
upload_index_file(service, index_file_name, 'Links for {}'.format(pkg_name), links)
53+
UPLOADED_PACKAGE_LINKS.append(index_file_name)
54+
55+
56+
def upload_package(service, file_path, pkg_name):
57+
print('Uploading {}'.format(file_path))
58+
file_name = os.path.basename(file_path)
59+
blob_name = '{}/{}'.format(pkg_name, file_name)
60+
service.create_blob_from_path(
61+
container_name=BLOB_CONTAINER_NAME,
62+
blob_name=blob_name,
63+
file_path=file_path
64+
)
65+
gen_pkg_index_html(service, pkg_name)
66+
67+
68+
def build(options):
69+
70+
supported_actions = ['nightly']
71+
action = None
72+
73+
if len(options) >= 1:
74+
if options[0] not in supported_actions:
75+
print('Please provide a supported action {}.'.format(supported_actions))
76+
return
77+
action = options[0]
78+
79+
if action == 'nightly':
80+
assert AZURE_STORAGE_CONNECTION_STRING, 'Set AZURE_STORAGE_CONNECTION_STRING environment variable'
81+
82+
print_heading('Cleanup')
83+
84+
# clean
85+
utility.clean_up(utility.MSSQLSCRIPTER_DIST_DIRECTORY)
86+
utility.clean_up(utility.MSSQLTOOLSSERVICE_DIST_DIRECTORY)
87+
utility.cleaun_up_egg_info_sub_directories(utility.ROOT_DIR)
88+
utility.cleaun_up_egg_info_sub_directories(utility.MSSQLTOOLSSERVICE_DIRECTORY)
89+
90+
print_heading('Running setup')
91+
92+
# install general requirements.
93+
utility.exec_command('pip install -r dev_requirements.txt', utility.ROOT_DIR)
94+
95+
print_heading('Running mssql-scripter tests')
96+
utility.exec_command('tox', utility.ROOT_DIR, continue_on_error = False)
97+
98+
print_heading('Building mssql-scripter pip package')
99+
utility.exec_command('python setup.py check -r -s sdist', utility.ROOT_DIR, continue_on_error = False)
100+
101+
print_heading('Building mssqltoolsservice pip package')
102+
utility.exec_command('python buildwheels.py', utility.MSSQLTOOLSSERVICE_DIRECTORY, continue_on_error = False)
103+
104+
if action == 'nightly':
105+
blob_service = BlockBlobService(connection_string=AZURE_STORAGE_CONNECTION_STRING)
106+
107+
print_heading('Uploading packages to blob storage ')
108+
for pkg in os.listdir(utility.MSSQLSCRIPTER_DIST_DIRECTORY):
109+
pkg_path = os.path.join(utility.MSSQLSCRIPTER_DIST_DIRECTORY, pkg)
110+
print('Uploading package {}'.format(pkg_path))
111+
upload_package(blob_service, pkg_path, 'mssql-scripter')
112+
113+
for pkg in os.listdir(utility.MSSQLTOOLSSERVICE_DIST_DIRECTORY):
114+
pkg_path = os.path.join(utility.MSSQLTOOLSSERVICE_DIST_DIRECTORY, pkg)
115+
pkg_name = os.path.basename(pkg_path).split('-')[0].replace('_', '-').lower()
116+
print('Uploading package {}'.format(pkg_name))
117+
upload_package(blob_service, pkg_path, pkg_name)
118+
119+
# Upload the final index file
120+
upload_index_file(blob_service, 'index.html', 'Simple Index', UPLOADED_PACKAGE_LINKS)
121+
122+
123+
if __name__ == '__main__':
124+
build(sys.argv[1:])

dev_requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ flake8 >= 3.3.0
1111
pytest >= 3.0.7
1212
pytest-cov >= 2.5.1
1313
readme_renderer >= 17.2
14-
docutils >= 0.13.1
14+
docutils >= 0.13.1
15+
azure-storage >= 0.33.0

dev_setup.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,16 @@
1212
import setup
1313
import utility
1414

15-
root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))
16-
1715
print('Running dev setup...')
18-
print('Root directory \'{}\'\n'.format(root_dir))
16+
print('Root directory \'{}\'\n'.format(utility.ROOT_DIR))
1917

2018
# install general requirements.
21-
utility.exec_command('pip install -r dev_requirements.txt', root_dir)
19+
utility.exec_command('pip install -r dev_requirements.txt', utility.ROOT_DIR)
2220

2321
# install mssqltoolsservice if this platform supports it.
2422
mssqltoolsservice_package_name = os.environ['MSSQLTOOLSSERVICE_PACKAGE_NAME']
2523
print('Installing {}...'.format(mssqltoolsservice_package_name))
2624
# mssqltoolsservice package name is retrieved from environment variable set by setup.py.
27-
utility.exec_command('pip install {}'.format(mssqltoolsservice_package_name), root_dir)
25+
utility.exec_command('pip install {}'.format(mssqltoolsservice_package_name), utility.ROOT_DIR)
2826

2927
print('Finished dev setup.')

doc/installation_guide.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Installation Guide
22

33
## Quick Start
4-
mssql-scritper is installed via pip. If you know pip, you can install mssql-scripter using command
4+
mssql-scripter is installed via pip. If you know pip, you can install mssql-scripter using command
55
```shell
66
$ pip install mssql-scripter
77
```
@@ -70,7 +70,7 @@ $ sudo apt-get install python-pip
7070
$ sudo pip install --upgrade pip
7171
```
7272

73-
Install mssql-scritper using command:
73+
Install mssql-scripter using command:
7474

7575
```shell
7676
$ sudo pip install mssql-scripter
@@ -103,7 +103,7 @@ More information can be found at:
103103

104104
- [Development guide](development_guide.md#Environment_Setup)
105105

106-
## Error: Could not find version that satifies the requirement mssql-scripter
106+
## Error: Could not find version that satisfies the requirement mssql-scripter
107107
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:
108108
```shell
109109
$ sudo apt-get install python-pip
@@ -141,7 +141,7 @@ $ sudo apt-get install libunwind8
141141
```
142142

143143
### Debian 8
144-
The file `/etc/apt/sources.list' needs to updated with the following line
144+
The file `/etc/apt/sources.list' needs to be updated with the following line
145145
```
146146
deb http://ftp.us.debian.org/debian/ jessie main
147147
```

doc/pypi_release_steps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ bumpversion release_version  -> 1.0.0a<b>1</b>
8686
    pypitest
8787
 
8888
[pypitest]
89-
repository = https://test.pypi.org/legacy
89+
repository = https://test.pypi.org/legacy/
9090
username = your_username
9191
password = your_password
9292
```

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.0a18'
6+
__version__ = '1.0.0a20'

mssqlscripter/jsonrpc/contracts/tests/test_scripting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def generate_new_baseline(self, file_name):
362362
# Point sqltoolsservice output to file.
363363
with io.open(file_name, 'wb') as baseline:
364364
tools_service_process = subprocess.Popen(
365-
'D:\\GitHub\\sqltoolsservice\\src\\Microsoft.SqlTools.ServiceLayer\\bin\\Debug\\netcoreapp1.0\\win7-x64\\Microsoft.SqlTools.ServiceLayer.exe',
365+
'D:\\GitHub\\sqltoolsservice\\src\\Microsoft.SqlTools.ServiceLayer\\bin\\Debug\\netcoreapp2.0\\win7-x64\\MicrosoftSqlToolsServiceLayer.exe',
366366
bufsize=0,
367367
stdin=subprocess.PIPE,
368368
stdout=baseline)

0 commit comments

Comments
 (0)