Add support for unstable Python versions (#38)

* Add support of unstable versions to package generation (#2)
* Add support of symver versions to Python setup scripts and tests

Co-authored-by: Maksim Petrov <47208721+vmapetr@users.noreply.github.com>
Co-authored-by: MaksimZhukov <v-mazhuk@microsoft.com>
Co-authored-by: Maxim Lobanov <v-malob@microsoft.com>
This commit is contained in:
MaksimZhukov
2020-07-15 13:13:21 +03:00
committed by GitHub
parent 67794a4d5f
commit 5c851d6172
17 changed files with 193 additions and 74 deletions

View File

@@ -0,0 +1,44 @@
Import-Module (Join-Path $PSScriptRoot "../helpers/packages-generation/manifest-utils.psm1")
$ConfigurationFile = Join-Path $PSScriptRoot "../config/python-manifest-config.json"
$Configuration = Read-ConfigurationFile -Filepath $ConfigurationFile
$stableTestCases = @(
@{ ReleaseName = "python-3.8.3-darwin-x64.tar.gz"; ExpectedResult = @{ platform = "darwin"; platform_version = $null; arch = "x64"} },
@{ ReleaseName = "python-3.8.3-linux-16.04-x64.tar.gz"; ExpectedResult = @{ platform = "linux"; platform_version = "16.04"; arch = "x64"} },
@{ ReleaseName = "python-3.8.3-linux-18.04-x64.tar.gz"; ExpectedResult = @{ platform = "linux"; platform_version = "18.04"; arch = "x64"} },
@{ ReleaseName = "python-3.8.3-linux-20.04-x64.tar.gz"; ExpectedResult = @{ platform = "linux"; platform_version = "20.04"; arch = "x64"} },
@{ ReleaseName = "python-3.8.3-win32-x64.zip"; ExpectedResult = @{ platform = "win32"; platform_version = $null; arch = "x64"} },
@{ ReleaseName = "python-3.8.3-win32-x86.zip"; ExpectedResult = @{ platform = "win32"; platform_version = $null; arch = "x86"} }
) | ForEach-Object { $_.Configuration = $Configuration; $_ }
$unstableTestCases = @(
@{ ReleaseName = "python-3.9.0-alpha.2-darwin-x64.tar.gz"; ExpectedResult = @{ platform = "darwin"; platform_version = $null; arch = "x64"} },
@{ ReleaseName = "python-3.9.0-beta.1-linux-16.04-x64.tar.gz"; ExpectedResult = @{ platform = "linux"; platform_version = "16.04"; arch = "x64"} },
@{ ReleaseName = "python-3.9.0-rc.4-linux-18.04-x64.tar.gz"; ExpectedResult = @{ platform = "linux"; platform_version = "18.04"; arch = "x64"} },
@{ ReleaseName = "python-3.9.0-beta.2-linux-20.04-x64.tar.gz"; ExpectedResult = @{ platform = "linux"; platform_version = "20.04"; arch = "x64"} },
@{ ReleaseName = "python-3.9.0-beta.2-win32-x64.zip"; ExpectedResult = @{ platform = "win32"; platform_version = $null; arch = "x64"} },
@{ ReleaseName = "python-3.9.0-beta.2-win32-x86.zip"; ExpectedResult = @{ platform = "win32"; platform_version = $null; arch = "x86"} }
) | ForEach-Object { $_.Configuration = $Configuration; $_ }
Describe "Python manifest config" {
Context "Stable versions" {
It "<ReleaseName>" -TestCases $stableTestCases {
$Release = @{ name = $ReleaseName }
$asset = New-AssetItem -ReleaseAsset $Release -Configuration $Configuration
$asset.platform | Should -Be $ExpectedResult.platform
$asset.platform_version | Should -Be $ExpectedResult.platform_version
$asset.arch | Should -Be $ExpectedResult.arch
}
}
Context "Prerelease versions" {
It "<ReleaseName>" -TestCases $unstableTestCases {
$Release = @{ name = $ReleaseName }
$asset = New-AssetItem -ReleaseAsset $Release -Configuration $Configuration
$asset.platform | Should -Be $ExpectedResult.platform
$asset.platform_version | Should -Be $ExpectedResult.platform_version
$asset.arch | Should -Be $ExpectedResult.arch
}
}
}

View File

@@ -1,7 +1,7 @@
param (
[Version] [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()]
[string] [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()]
$Version,
[String] [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()]
[string] [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()]
$Platform
)
@@ -59,7 +59,7 @@ Describe "Tests" {
}
It "Check if python configuration is correct" {
"python ./sources/python-config-test.py" | Should -ReturnZeroExitCode
"python ./sources/python-config-test.py $Version" | Should -ReturnZeroExitCode
}
It "Check if shared libraries are linked correctly" {

View File

@@ -6,7 +6,7 @@ import os
# Define variables
os_type = platform.system()
version = sys.version.split(" ")[0]
version = sys.argv[1]
lib_dir_path = sysconfig.get_config_var('LIBDIR')
ld_library_name = sysconfig.get_config_var('LDLIBRARY')

View File

@@ -251,6 +251,10 @@ if sys.version_info >= (3, 7):
if sys.version_info > (3, 7):
standard_library.remove('macpath')
# 'dummy_threading' module has been removed from Python 3.9
if sys.version_info > (3, 8):
standard_library.remove('dummy_threading')
# Remove tkinter and Easter eggs
excluded_modules = [
'antigravity',