Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added package properties SDKType and NewSDK #16476

Merged
merged 4 commits into from
Feb 4, 2021
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
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 @@ -461,3 +462,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):
Copy link
Member

@scbedd scbedd Feb 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's a new SDK if the package is azure-core, azure-mgmt-core, or if any of the requirements are one of those?

I'm super confused. is_new_sdk must not be what i am thinking based on the name.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference we are following Azure/azure-sdk#1261 (comment). The idea is we needed a way to detect if a package is track 2 (aka new).

"""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