From 98a87cb22fac11769529645329c27823465ae905 Mon Sep 17 00:00:00 2001 From: praveenkuttappan <55455725+praveenkuttappan@users.noreply.github.com> Date: Wed, 3 Feb 2021 17:45:04 -0800 Subject: [PATCH] Added package properties SDKType and NewSDK (#16476) * Added package properties SDKType and NewSDK --- eng/pipelines/templates/steps/build-artifacts.yml | 3 ++- eng/pipelines/templates/steps/set-dev-build.yml | 2 ++ eng/scripts/Language-Settings.ps1 | 14 ++++++++++++-- scripts/devops_tasks/common_tasks.py | 7 +++++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/templates/steps/build-artifacts.yml b/eng/pipelines/templates/steps/build-artifacts.yml index 5088ca6919a8..7da0788bd79c 100644 --- a/eng/pipelines/templates/steps/build-artifacts.yml +++ b/eng/pipelines/templates/steps/build-artifacts.yml @@ -57,7 +57,8 @@ steps: arguments: '-d "$(Build.ArtifactStagingDirectory)" "${{ parameters.BuildTargetingString }}" --service=${{parameters.ServiceDirectory}} --devbuild="$(SetDevVersion)"' - script: | - twine check $(Build.ArtifactStagingDirectory)/* + twine check $(Build.ArtifactStagingDirectory)/*.whl + twine check $(Build.ArtifactStagingDirectory)/*.zip displayName: 'Verify Readme' - task: PythonScript@0 diff --git a/eng/pipelines/templates/steps/set-dev-build.yml b/eng/pipelines/templates/steps/set-dev-build.yml index 15fe9c3c5e69..77f6bb99c567 100644 --- a/eng/pipelines/templates/steps/set-dev-build.yml +++ b/eng/pipelines/templates/steps/set-dev-build.yml @@ -4,6 +4,8 @@ parameters: steps: - template: /eng/common/pipelines/templates/steps/daily-dev-build-variable.yml + parameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} - task: PythonScript@0 condition: and(succeededOrFailed(), eq(variables['SetDevVersion'],'true')) diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index bd21ec403c54..d2b7e5690caf 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -13,11 +13,21 @@ function Get-python-PackageInfoFromRepo ($pkgPath, $serviceDirectory, $pkgName) { $setupLocation = $pkgPath.Replace('\','/') pushd $RepoRoot - $setupProps = (python -c "import sys; import os; sys.path.append(os.path.join('scripts', 'devops_tasks')); from common_tasks import parse_setup; obj=parse_setup('$setupLocation'); print('{0},{1}'.format(obj[0], obj[1]));") -split "," + $setupProps = (python -c "import sys; import os; sys.path.append(os.path.join('scripts', 'devops_tasks')); from common_tasks import get_package_properties; obj=get_package_properties('$setupLocation'); print('{0},{1},{2}'.format(obj[0], obj[1], obj[2]));") -split "," popd if (($setupProps -ne $null) -and ($setupProps[0] -eq $pkgName)) { - return [PackageProps]::new($setupProps[0], $setupProps[1], $pkgPath, $serviceDirectory) + $pkgProp = [PackageProps]::new($setupProps[0], $setupProps[1], $pkgPath, $serviceDirectory) + if ($pkgName -match "mgmt") + { + $pkgProp.SdkType = "mgmt" + } + else + { + $pkgProp.SdkType = "client" + } + $pkgProp.IsNewSdk = $setupProps[3] + return $pkgProp } } return $null diff --git a/scripts/devops_tasks/common_tasks.py b/scripts/devops_tasks/common_tasks.py index 8333cd093205..af96f0550d61 100644 --- a/scripts/devops_tasks/common_tasks.py +++ b/scripts/devops_tasks/common_tasks.py @@ -32,6 +32,7 @@ DEV_REQ_FILE = "dev_requirements.txt" NEW_DEV_REQ_FILE = "new_dev_requirements.txt" +NEW_REQ_PACKAGES = ["azure-core", "azure-mgmt-core"] logging.getLogger().setLevel(logging.INFO) @@ -462,3 +463,9 @@ def get_installed_packages(paths = None): ws = WorkingSet(paths) if paths else working_set return ["{0}=={1}".format(p.project_name, p.version) for p in ws] +def get_package_properties(setup_py_path): + """Parse setup.py and return package details like package name, version, whether it's new SDK + """ + pkgName, version, _, requires = parse_setup(setup_py_path) + is_new_sdk = pkgName in NEW_REQ_PACKAGES or any(map(lambda x: (parse_require(x)[0] in NEW_REQ_PACKAGES), requires)) + return pkgName, version, is_new_sdk