From a54df6f18ed59993844e8e6672f599ec08e87022 Mon Sep 17 00:00:00 2001 From: Scott Beddall <45376673+scbedd@users.noreply.github.com> Date: Tue, 20 Jul 2021 13:28:12 -0700 Subject: [PATCH] resolve 409 failures by enabling dev versioning for mgmt/nspkg, but _not_ auto incrementing (#19868) --- eng/tox/sanitize_setup.py | 2 +- eng/versioning/version_increment.py | 2 +- eng/versioning/version_shared.py | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/eng/tox/sanitize_setup.py b/eng/tox/sanitize_setup.py index eb78dc294304..1d01345c1790 100644 --- a/eng/tox/sanitize_setup.py +++ b/eng/tox/sanitize_setup.py @@ -96,7 +96,7 @@ def process_requires(setup_py_path): requires = [ Requirement.parse(r) for r in get_install_requires(setup_py_path) - if r.startswith("azure") and "-nspkg" not in r + if r.startswith("azure") ] # Find package requirements that are not available on PyPI requirement_to_update = {} diff --git a/eng/versioning/version_increment.py b/eng/versioning/version_increment.py index 3ac56b45ee4c..eb73b5b450f1 100644 --- a/eng/versioning/version_increment.py +++ b/eng/versioning/version_increment.py @@ -42,7 +42,7 @@ def increment_version(old_version): package_name = args.package_name.replace('_', '-') - packages = get_packages(args, package_name) + packages = get_packages(args, package_name, additional_excludes = ["mgmt", "-nspkg"]) package_map = { pkg[1][0]: pkg for pkg in packages } diff --git a/eng/versioning/version_shared.py b/eng/versioning/version_shared.py index 8e86574d008a..62aa49534d09 100644 --- a/eng/versioning/version_shared.py +++ b/eng/versioning/version_shared.py @@ -34,8 +34,8 @@ logging.getLogger().setLevel(logging.INFO) -def path_excluded(path): - return "-nspkg" in path or "tests" in path or "mgmt" in path or is_metapackage(path) +def path_excluded(path, additional_excludes): + return any([excl in path for excl in additional_excludes]) or "tests" in path or is_metapackage(path) # Metapackages do not have an 'azure' folder within them def is_metapackage(package_path): @@ -44,13 +44,13 @@ def is_metapackage(package_path): azure_path = path.join(dir_path, 'azure') return not path.exists(azure_path) -def get_setup_py_paths(glob_string, base_path): +def get_setup_py_paths(glob_string, base_path, additional_excludes): setup_paths = process_glob_string(glob_string, base_path) - filtered_paths = [path.join(p, 'setup.py') for p in setup_paths if not path_excluded(p)] + filtered_paths = [path.join(p, 'setup.py') for p in setup_paths if not path_excluded(p, additional_excludes)] return filtered_paths -def get_packages(args, package_name = ""): +def get_packages(args, package_name = "", additional_excludes = []): # This function returns list of path to setup.py and setup info like install requires, version for all packages discovered using glob # Followiong are the list of arguements expected and parsed by this method # service, glob_string @@ -59,7 +59,7 @@ def get_packages(args, package_name = ""): else: target_dir = root_dir - paths = get_setup_py_paths(args.glob_string, target_dir) + paths = get_setup_py_paths(args.glob_string, target_dir, additional_excludes) # Check if package is excluded if a package name param is passed if package_name and not any(filter(lambda x: package_name == os.path.basename(os.path.dirname(x)), paths)):