Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .docsettings.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
omitted_paths:
- azure-sdk-tools/*
- tools/*
- scripts/*
- azure-mgmt-netapp/tests/*
- "azure-mgmt*/*"
Expand Down
103 changes: 67 additions & 36 deletions scripts/dev_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,81 +14,112 @@
from collections import Counter
from subprocess import check_call, CalledProcessError

root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), '..', '..'))
root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", ".."))

def pip_command(command, additional_dir='.', error_ok=False):

def pip_command(command, additional_dir=".", error_ok=False):
try:
print('Executing: {} from {}'.format(command, additional_dir))
check_call([sys.executable, '-m', 'pip'] + command.split(), cwd=os.path.join(root_dir, additional_dir))
print("Executing: {} from {}".format(command, additional_dir))
check_call(
[sys.executable, "-m", "pip"] + command.split(),
cwd=os.path.join(root_dir, additional_dir),
)
print()
except CalledProcessError as err:
print(err, file=sys.stderr)
if not error_ok:
sys.exit(1)


# optional argument in a situation where we want to build a variable subset of packages
parser = argparse.ArgumentParser(description='Set up the dev environment for selected packages.')
parser.add_argument('--packageList', '-p',
dest='packageList',
default='',
help='Comma separated list of targeted packages. Used to limit the number of packages that dependencies will be installed for.')
parser = argparse.ArgumentParser(
description="Set up the dev environment for selected packages."
)
parser.add_argument(
"--packageList",
"-p",
dest="packageList",
default="",
help="Comma separated list of targeted packages. Used to limit the number of packages that dependencies will be installed for.",
)
args = parser.parse_args()

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

# keep targeted packages separate. python2 needs the nspkgs to work properly.
if not args.packageList:
targeted_packages = list(packages.keys())
else:
targeted_packages = [os.path.relpath(x.strip()) for x in args.packageList.split(',')]
targeted_packages = [
os.path.relpath(x.strip()) for x in args.packageList.split(",")
]

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

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

content_packages = sorted([p for p in packages.keys() if p not in nspkg_packages+meta_packages and p in targeted_packages])
content_packages = sorted(
[
p
for p in packages.keys()
if p not in nspkg_packages + meta_packages and p in targeted_packages
]
)

# Put azure-common in front
if 'azure-common' in content_packages:
content_packages.remove('azure-common')
content_packages.insert(0, 'azure-common')
if "azure-common" in content_packages:
content_packages.remove("azure-common")
content_packages.insert(0, "azure-common")

if 'azure-sdk-tools' in content_packages:
content_packages.remove('azure-sdk-tools')
content_packages.insert(1, 'azure-sdk-tools')
if "azure-sdk-tools" in content_packages:
content_packages.remove("azure-sdk-tools")
content_packages.insert(1, "azure-sdk-tools")

print('Running dev setup...')
print('Root directory \'{}\'\n'.format(root_dir))
print("Running dev setup...")
print("Root directory '{}'\n".format(root_dir))

# install private whls if there are any
privates_dir = os.path.join(root_dir, 'privates')
privates_dir = os.path.join(root_dir, "privates")
if os.path.isdir(privates_dir) and os.listdir(privates_dir):
whl_list = ' '.join([os.path.join(privates_dir, f) for f in os.listdir(privates_dir)])
pip_command('install {}'.format(whl_list))
whl_list = " ".join(
[os.path.join(privates_dir, f) for f in os.listdir(privates_dir)]
)
pip_command("install {}".format(whl_list))

# install nspkg only on py2, but in wheel mode (not editable mode)
if sys.version_info < (3, ):
if sys.version_info < (3,):
for package_name in nspkg_packages:
pip_command('install {}/{}/'.format(packages[package_name], package_name))
pip_command("install {}/{}/".format(packages[package_name], package_name))

# install packages
for package_name in content_packages:
print("Installing {}".format(package_name))
# if we are running dev_setup with no arguments. going after dev_requirements will be a pointless exercise
# and waste of cycles as all the dependencies will be installed regardless.
if os.path.isfile('{}/{}/dev_requirements.txt'.format(packages[package_name], package_name)):
pip_command('install -r dev_requirements.txt', os.path.join(packages[package_name], package_name))
pip_command('install --ignore-requires-python -e {}'.format(os.path.join(packages[package_name], package_name)))
if os.path.isfile(
"{}/{}/dev_requirements.txt".format(packages[package_name], package_name)
):
pip_command(
"install -r dev_requirements.txt",
os.path.join(packages[package_name], package_name),
)
pip_command(
"install --ignore-requires-python -e {}".format(
os.path.join(packages[package_name], package_name)
)
)

# On Python 3, uninstall azure-nspkg if he got installed
if sys.version_info >= (3, ):
pip_command('uninstall -y azure-nspkg', error_ok=True)
if sys.version_info >= (3,):
pip_command("uninstall -y azure-nspkg", error_ok=True)

print("Finished dev setup.")

print('Finished dev setup.')
2 changes: 1 addition & 1 deletion sdk/advisor/azure-mgmt-advisor/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/appservice/azure-mgmt-web/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/batch/azure-batch/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
-e ../azure-mgmt-batch
2 changes: 1 addition & 1 deletion sdk/batch/azure-mgmt-batch/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
-e ../../keyvault/azure-mgmt-keyvault
2 changes: 1 addition & 1 deletion sdk/billing/azure-mgmt-billing/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/botservice/azure-mgmt-botservice/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/cdn/azure-mgmt-cdn/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/commerce/azure-mgmt-commerce/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/compute/azure-mgmt-compute/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
-e ../../authorization/azure-mgmt-authorization
-e ../../storage/azure-mgmt-storage
-e ../../network/azure-mgmt-network
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
-e ../../storage/azure-mgmt-storage
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/core/azure-common/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/cosmos/azure-mgmt-cosmosdb/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/cosmos/azure-mgmt-documentdb/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
-e ../../network/azure-mgmt-network
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/eventgrid/azure-eventgrid/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/eventgrid/azure-mgmt-eventgrid/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/eventhub/azure-mgmt-eventhub/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/graphrbac/azure-graphrbac/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/iothub/azure-mgmt-iotcentral/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/iothub/azure-mgmt-iothub/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/keyvault/azure-keyvault/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-e ../../authorization/azure-mgmt-authorization
-e ../../core/azure-core
-e ../azure-mgmt-keyvault
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/keyvault/azure-mgmt-keyvault/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/loganalytics/azure-loganalytics/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/logic/azure-mgmt-logic/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/media/azure-mgmt-media/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
-e ../../storage/azure-mgmt-storage
2 changes: 1 addition & 1 deletion sdk/monitor/azure-mgmt-monitor/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/network/azure-mgmt-dns/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
-e ../azure-mgmt-network
2 changes: 1 addition & 1 deletion sdk/network/azure-mgmt-network/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
-e ../../resources/azure-mgmt-resource
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
-e ../azure-mgmt-recoveryservices
2 changes: 1 addition & 1 deletion sdk/redis/azure-mgmt-redis/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/relay/azure-mgmt-relay/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/resources/azure-mgmt-resource/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/scheduler/azure-mgmt-scheduler/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/search/azure-mgmt-search/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/servicebus/azure-mgmt-servicebus/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/servicebus/azure-servicebus/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
pylint==2.1.1; python_version >= '3.4'
pylint==1.8.4; python_version < '3.4'
2 changes: 1 addition & 1 deletion sdk/sql/azure-mgmt-sql/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/storage/azure-mgmt-storage/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion sdk/template/azure-template/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-e ../../../azure-sdk-tools
-e ../../../tools/azure-sdk-tools
4 changes: 2 additions & 2 deletions sdk/template/azure-template/sdk_packaging.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[packaging]
auto_update = true
auto_update = false
package_name = "azure-template"
package_pprint_name = "Template Package"
is_stable = false
is_arm = false

# Package owners should uncomment and set this doc id.
# package_doc_id = "<your doc id>"
# package_doc_id = "<your doc id>"
Loading