Skip to content

Commit

Permalink
Move template project to new repo structure (Azure#4564)
Browse files Browse the repository at this point in the history
Update scripts to understand new sdk\<service>\<package>
naming convention.
  • Loading branch information
weshaggard authored Mar 19, 2019
1 parent ab6639b commit 6d838d3
Show file tree
Hide file tree
Showing 17 changed files with 17 additions and 17 deletions.
1 change: 0 additions & 1 deletion azure-template/dev_requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/analyze_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def should_skip_lib(lib_name):
return lib_name in skip_pkgs or lib_name.endswith('-nspkg')

def locate_libs(base_dir):
packages = [os.path.dirname(p) for p in glob.glob(os.path.join(base_dir, 'azure*', 'setup.py'))]
packages = [os.path.dirname(p) for p in (glob.glob(os.path.join(base_dir, 'azure*', 'setup.py')) + glob.glob(os.path.join(base_dir, 'sdk/*/azure*', 'setup.py')))]
return sorted(packages)

def locate_wheels(base_dir):
Expand Down
14 changes: 7 additions & 7 deletions scripts/dev_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ def pip_command(command, additionalDir='.', error_ok=False):

# 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='',
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')]
packages = [os.path.dirname(p) for p in (glob.glob('azure*/setup.py') + glob.glob('sdk/*/azure*/setup.py'))]

# keep targeted packages separate. python2 needs the nspkgs to work properly.
if not args.packageList:
targeted_packages = [os.path.dirname(p) for p in glob.glob('azure*/setup.py')]
targeted_packages = packages
else:
targeted_packages = [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 if 'nspkg' in p]
Expand Down Expand Up @@ -77,7 +77,7 @@ def pip_command(command, additionalDir='.', error_ok=False):
# install packages
for package_name in content_packages:
# 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.
# and waste of cycles as all the dependencies will be installed regardless.
if os.path.isfile('{}/dev_requirements.txt'.format(package_name)):
pip_command('install -r dev_requirements.txt', package_name)
pip_command('install --ignore-requires-python -e {}'.format(package_name))
Expand Down
8 changes: 4 additions & 4 deletions scripts/devops_tasks/common_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# Below are common methods for the devops build steps. This is the common location that will be updated with
# Below are common methods for the devops build steps. This is the common location that will be updated with
# package targeting during release.

import glob
Expand All @@ -14,10 +14,10 @@
import os
import sys

DEFAULT_BUILD_PACKAGES = ['azure-keyvault', 'azure-servicebus']
DEFAULT_BUILD_PACKAGES = ['azure-keyvault', 'azure-servicebus']

# this function is where a glob string gets translated to a list of packages
# It is called by both BUILD (package) and TEST. In the future, this function will be the central location
# It is called by both BUILD (package) and TEST. In the future, this function will be the central location
# for handling targeting of release packages
def process_glob_string(glob_string, target_root_dir):
if glob_string:
Expand All @@ -27,7 +27,7 @@ def process_glob_string(glob_string, target_root_dir):
collected_top_level_directories = []

for glob_string in individual_globs:
globbed = glob.glob(os.path.join(target_root_dir, glob_string, 'setup.py'))
globbed = glob.glob(os.path.join(target_root_dir, glob_string, 'setup.py')) + glob.glob(os.path.join(target_root_dir, "sdk/*/", glob_string, 'setup.py'))
collected_top_level_directories.extend([os.path.dirname(p) for p in globbed])

# dedup, in case we have double coverage from the glob strings. Example: "azure-mgmt-keyvault,azure-mgmt-*"
Expand Down
4 changes: 2 additions & 2 deletions scripts/devops_tasks/setup_execute_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

# a return code of 5 from pytest == no tests run
# evaluating whether we want this or not.
ALLOWED_RETURN_CODES = []
ALLOWED_RETURN_CODES = []

def prep_and_run_tests(targeted_packages, python_version, test_res):
print('running test setup for {}'.format(targeted_packages))
run_check_call([python_version, dev_setup_script_location, '-p', ','.join([os.path.basename(package_path) for package_path in targeted_packages])], root_dir)
run_check_call([python_version, dev_setup_script_location, '-p', ','.join(targeted_packages)], root_dir)

print('Setup complete. Running pytest for {}'.format(targeted_packages))
command_array = [python_version, '-m', 'pytest']
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ More sample code should go here, along with links out to the appropriate example

If you encounter any bugs or have suggestions, please file an issue in the [Issues](<https://github.com/Azure/azure-sdk-for-python/issues>) section of the project.

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-template%2FREADME.png)
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fsdk%2Ftemplate%2Fazure-template%2FREADME.png)
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions sdk/template/azure-template/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-e ../../../azure-sdk-tools
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

root_folder = os.path.abspath(os.path.dirname(__file__))

packages = [os.path.dirname(p) for p in glob.glob('azure*/setup.py')]
packages = [os.path.dirname(p) for p in (glob.glob('azure*/setup.py') + glob.glob('sdk/*/azure*/setup.py'))]

# "install" is used by ReadTheDocs, do not install "nspkg"

Expand Down

0 comments on commit 6d838d3

Please sign in to comment.