Skip to content

Commit

Permalink
Added package properties SDKType and NewSDK (#16476)
Browse files Browse the repository at this point in the history
* Added package properties SDKType and NewSDK
  • Loading branch information
praveenkuttappan authored Feb 4, 2021
1 parent 52ff963 commit 98a87cb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
3 changes: 2 additions & 1 deletion eng/pipelines/templates/steps/build-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions eng/pipelines/templates/steps/set-dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
14 changes: 12 additions & 2 deletions eng/scripts/Language-Settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions scripts/devops_tasks/common_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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

0 comments on commit 98a87cb

Please sign in to comment.