Skip to content

Commit 9c07a77

Browse files
authored
Tools folder (Azure#5734)
* Move to SDK tools * Change them all * Update dev_setup * Template should ask no update by default * Refix dev_setup * Do not check Readme inside tools folder * Re-re-fix and tested dev_setup * Blackened
1 parent 5599cf1 commit 9c07a77

File tree

93 files changed

+133
-102
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+133
-102
lines changed

.docsettings.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
omitted_paths:
2-
- azure-sdk-tools/*
2+
- tools/*
33
- scripts/*
44
- azure-mgmt-netapp/tests/*
55
- "azure-mgmt*/*"

scripts/dev_setup.py

+67-36
Original file line numberDiff line numberDiff line change
@@ -14,81 +14,112 @@
1414
from collections import Counter
1515
from subprocess import check_call, CalledProcessError
1616

17-
root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), '..', '..'))
17+
root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", ".."))
1818

19-
def pip_command(command, additional_dir='.', error_ok=False):
19+
20+
def pip_command(command, additional_dir=".", error_ok=False):
2021
try:
21-
print('Executing: {} from {}'.format(command, additional_dir))
22-
check_call([sys.executable, '-m', 'pip'] + command.split(), cwd=os.path.join(root_dir, additional_dir))
22+
print("Executing: {} from {}".format(command, additional_dir))
23+
check_call(
24+
[sys.executable, "-m", "pip"] + command.split(),
25+
cwd=os.path.join(root_dir, additional_dir),
26+
)
2327
print()
2428
except CalledProcessError as err:
2529
print(err, file=sys.stderr)
2630
if not error_ok:
2731
sys.exit(1)
2832

33+
2934
# optional argument in a situation where we want to build a variable subset of packages
30-
parser = argparse.ArgumentParser(description='Set up the dev environment for selected packages.')
31-
parser.add_argument('--packageList', '-p',
32-
dest='packageList',
33-
default='',
34-
help='Comma separated list of targeted packages. Used to limit the number of packages that dependencies will be installed for.')
35+
parser = argparse.ArgumentParser(
36+
description="Set up the dev environment for selected packages."
37+
)
38+
parser.add_argument(
39+
"--packageList",
40+
"-p",
41+
dest="packageList",
42+
default="",
43+
help="Comma separated list of targeted packages. Used to limit the number of packages that dependencies will be installed for.",
44+
)
3545
args = parser.parse_args()
3646

37-
packages = {('.', os.path.dirname(p)) for p in glob.glob('azure*/setup.py')}
38-
# Handle the SDK folder as well
39-
packages.update({tuple(os.path.dirname(f).rsplit(os.sep, 1)) for f in glob.glob('sdk/*/azure*/setup.py')})
47+
packages = {
48+
tuple(os.path.dirname(f).rsplit(os.sep, 1))
49+
for f in glob.glob("sdk/*/azure*/setup.py") + glob.glob("tools/azure*/setup.py")
50+
}
4051
# [(base_folder, package_name), ...] to {package_name: base_folder, ...}
4152
packages = {package_name: base_folder for (base_folder, package_name) in packages}
4253

4354
# keep targeted packages separate. python2 needs the nspkgs to work properly.
4455
if not args.packageList:
4556
targeted_packages = list(packages.keys())
4657
else:
47-
targeted_packages = [os.path.relpath(x.strip()) for x in args.packageList.split(',')]
58+
targeted_packages = [
59+
os.path.relpath(x.strip()) for x in args.packageList.split(",")
60+
]
4861

4962
# Extract nspkg and sort nspkg by number of "-"
50-
nspkg_packages = [p for p in packages.keys() if 'nspkg' in p]
51-
nspkg_packages.sort(key = lambda x: len([c for c in x if c == '-']))
63+
nspkg_packages = [p for p in packages.keys() if "nspkg" in p]
64+
nspkg_packages.sort(key=lambda x: len([c for c in x if c == "-"]))
5265

5366
# Manually push meta-packages at the end, in reverse dependency order
54-
meta_packages = ['azure-mgmt', 'azure']
67+
meta_packages = ["azure-mgmt", "azure"]
5568

56-
content_packages = sorted([p for p in packages.keys() if p not in nspkg_packages+meta_packages and p in targeted_packages])
69+
content_packages = sorted(
70+
[
71+
p
72+
for p in packages.keys()
73+
if p not in nspkg_packages + meta_packages and p in targeted_packages
74+
]
75+
)
5776

5877
# Put azure-common in front
59-
if 'azure-common' in content_packages:
60-
content_packages.remove('azure-common')
61-
content_packages.insert(0, 'azure-common')
78+
if "azure-common" in content_packages:
79+
content_packages.remove("azure-common")
80+
content_packages.insert(0, "azure-common")
6281

63-
if 'azure-sdk-tools' in content_packages:
64-
content_packages.remove('azure-sdk-tools')
65-
content_packages.insert(1, 'azure-sdk-tools')
82+
if "azure-sdk-tools" in content_packages:
83+
content_packages.remove("azure-sdk-tools")
84+
content_packages.insert(1, "azure-sdk-tools")
6685

67-
print('Running dev setup...')
68-
print('Root directory \'{}\'\n'.format(root_dir))
86+
print("Running dev setup...")
87+
print("Root directory '{}'\n".format(root_dir))
6988

7089
# install private whls if there are any
71-
privates_dir = os.path.join(root_dir, 'privates')
90+
privates_dir = os.path.join(root_dir, "privates")
7291
if os.path.isdir(privates_dir) and os.listdir(privates_dir):
73-
whl_list = ' '.join([os.path.join(privates_dir, f) for f in os.listdir(privates_dir)])
74-
pip_command('install {}'.format(whl_list))
92+
whl_list = " ".join(
93+
[os.path.join(privates_dir, f) for f in os.listdir(privates_dir)]
94+
)
95+
pip_command("install {}".format(whl_list))
7596

7697
# install nspkg only on py2, but in wheel mode (not editable mode)
77-
if sys.version_info < (3, ):
98+
if sys.version_info < (3,):
7899
for package_name in nspkg_packages:
79-
pip_command('install {}/{}/'.format(packages[package_name], package_name))
100+
pip_command("install {}/{}/".format(packages[package_name], package_name))
80101

81102
# install packages
82103
for package_name in content_packages:
83104
print("Installing {}".format(package_name))
84105
# if we are running dev_setup with no arguments. going after dev_requirements will be a pointless exercise
85106
# and waste of cycles as all the dependencies will be installed regardless.
86-
if os.path.isfile('{}/{}/dev_requirements.txt'.format(packages[package_name], package_name)):
87-
pip_command('install -r dev_requirements.txt', os.path.join(packages[package_name], package_name))
88-
pip_command('install --ignore-requires-python -e {}'.format(os.path.join(packages[package_name], package_name)))
107+
if os.path.isfile(
108+
"{}/{}/dev_requirements.txt".format(packages[package_name], package_name)
109+
):
110+
pip_command(
111+
"install -r dev_requirements.txt",
112+
os.path.join(packages[package_name], package_name),
113+
)
114+
pip_command(
115+
"install --ignore-requires-python -e {}".format(
116+
os.path.join(packages[package_name], package_name)
117+
)
118+
)
89119

90120
# On Python 3, uninstall azure-nspkg if he got installed
91-
if sys.version_info >= (3, ):
92-
pip_command('uninstall -y azure-nspkg', error_ok=True)
121+
if sys.version_info >= (3,):
122+
pip_command("uninstall -y azure-nspkg", error_ok=True)
123+
124+
print("Finished dev setup.")
93125

94-
print('Finished dev setup.')
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
22
-e ../azure-mgmt-batch
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
22
-e ../../keyvault/azure-mgmt-keyvault
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
22
-e ../../authorization/azure-mgmt-authorization
33
-e ../../storage/azure-mgmt-storage
44
-e ../../network/azure-mgmt-network
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
22
-e ../../storage/azure-mgmt-storage
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
22
-e ../../network/azure-mgmt-network
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
-e ../../authorization/azure-mgmt-authorization
22
-e ../../core/azure-core
33
-e ../azure-mgmt-keyvault
4-
-e ../../../azure-sdk-tools
4+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
22
-e ../../storage/azure-mgmt-storage
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
22
-e ../azure-mgmt-network
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
22
-e ../../resources/azure-mgmt-resource
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
22
-e ../azure-mgmt-recoveryservices
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
22
pylint==2.1.1; python_version >= '3.4'
33
pylint==1.8.4; python_version < '3.4'
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-e ../../../azure-sdk-tools
1+
-e ../../../tools/azure-sdk-tools
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[packaging]
2-
auto_update = true
2+
auto_update = false
33
package_name = "azure-template"
44
package_pprint_name = "Template Package"
55
is_stable = false
66
is_arm = false
77

88
# Package owners should uncomment and set this doc id.
9-
# package_doc_id = "<your doc id>"
9+
# package_doc_id = "<your doc id>"

0 commit comments

Comments
 (0)