2020-11-23 10:29:46 +00:00
|
|
|
using module "./win-python-builder.psm1"
|
|
|
|
using module "./ubuntu-python-builder.psm1"
|
|
|
|
using module "./macos-python-builder.psm1"
|
2020-04-29 07:57:27 +00:00
|
|
|
|
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Generate Python artifact.
|
|
|
|
|
|
|
|
.DESCRIPTION
|
|
|
|
Main script that creates instance of PythonBuilder and builds of Python using specified parameters.
|
|
|
|
|
|
|
|
.PARAMETER Version
|
|
|
|
Required parameter. The version with which Python will be built.
|
|
|
|
|
|
|
|
.PARAMETER Architecture
|
|
|
|
Optional parameter. The architecture with which Python will be built. Using x64 by default.
|
|
|
|
|
|
|
|
.PARAMETER Platform
|
|
|
|
Required parameter. The platform for which Python will be built.
|
|
|
|
|
|
|
|
#>
|
|
|
|
|
|
|
|
param(
|
2020-07-15 10:13:21 +00:00
|
|
|
[Parameter (Mandatory=$true)][semver] $Version,
|
2020-04-29 07:57:27 +00:00
|
|
|
[Parameter (Mandatory=$true)][string] $Platform,
|
|
|
|
[string] $Architecture = "x64"
|
|
|
|
)
|
|
|
|
|
|
|
|
Import-Module (Join-Path $PSScriptRoot "../helpers" | Join-Path -ChildPath "common-helpers.psm1") -DisableNameChecking
|
|
|
|
Import-Module (Join-Path $PSScriptRoot "../helpers" | Join-Path -ChildPath "nix-helpers.psm1") -DisableNameChecking
|
|
|
|
Import-Module (Join-Path $PSScriptRoot "../helpers" | Join-Path -ChildPath "win-helpers.psm1") -DisableNameChecking
|
2020-07-15 10:13:21 +00:00
|
|
|
Import-Module (Join-Path $PSScriptRoot "python-version.psm1") -DisableNameChecking
|
2020-04-29 07:57:27 +00:00
|
|
|
|
|
|
|
function Get-PythonBuilder {
|
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Wrapper for class constructor to simplify importing PythonBuilder.
|
|
|
|
|
|
|
|
.DESCRIPTION
|
|
|
|
Create instance of PythonBuilder with specified parameters.
|
|
|
|
|
|
|
|
.PARAMETER Version
|
|
|
|
The version with which Python will be built.
|
|
|
|
|
|
|
|
.PARAMETER Architecture
|
|
|
|
The architecture with which Python will be built.
|
|
|
|
|
|
|
|
.PARAMETER Platform
|
|
|
|
The platform for which Python will be built.
|
|
|
|
|
|
|
|
#>
|
|
|
|
|
2020-07-15 10:13:21 +00:00
|
|
|
param(
|
|
|
|
[semver] $Version,
|
2020-04-29 07:57:27 +00:00
|
|
|
[string] $Architecture,
|
|
|
|
[string] $Platform
|
|
|
|
)
|
|
|
|
|
2020-06-03 17:38:34 +00:00
|
|
|
if ($Platform -match 'win32') {
|
2020-04-29 07:57:27 +00:00
|
|
|
$builder = [WinPythonBuilder]::New($Version, $Architecture, $Platform)
|
2020-06-03 17:38:34 +00:00
|
|
|
} elseif ($Platform -match 'linux') {
|
2020-04-29 07:57:27 +00:00
|
|
|
$builder = [UbuntuPythonBuilder]::New($Version, $Architecture, $Platform)
|
2020-06-03 17:38:34 +00:00
|
|
|
} elseif ($Platform -match 'darwin') {
|
2020-04-29 07:57:27 +00:00
|
|
|
$builder = [macOSPythonBuilder]::New($Version, $Architecture, $Platform)
|
|
|
|
} else {
|
|
|
|
Write-Host "##vso[task.logissue type=error;] Invalid platform: $Platform"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
return $builder
|
|
|
|
}
|
|
|
|
|
|
|
|
### Create Python builder instance, and build artifact
|
2020-07-15 10:13:21 +00:00
|
|
|
$Builder = Get-PythonBuilder -Version $Version -Architecture $Architecture -Platform $Platform
|
2020-04-29 07:57:27 +00:00
|
|
|
$Builder.Build()
|