@@ -36,6 +36,12 @@ BeforeAll {
36
36
37
37
return 0
38
38
}
39
+
40
+ function moveAssets ([string ] $source , [string ] $destination ) {
41
+ $parentDestDir = Split-Path - Path $destination - Parent
42
+ New-Item - Path $parentDestDir - ItemType Directory - Force
43
+ Move-Item - Path $source - Destination $parentDestDir - Force
44
+ }
39
45
}
40
46
41
47
Describe " Tests" {
@@ -88,6 +94,30 @@ Describe "Tests" {
88
94
It " Check if shared libraries are linked correctly" {
89
95
" bash ./sources/psutil-install-test.sh" | Should - ReturnZeroExitCode
90
96
}
97
+
98
+ It " Relocatable Python" {
99
+ $semversion = [semver ] $Version
100
+ $pyfilename = " python$ ( $semversion.Major ) .$ ( $semversion.Minor ) "
101
+ $artifactPath = Join-Path " Python" $Version | Join-Path - ChildPath $Architecture
102
+
103
+ $relocatedPython = Join-Path $HOME " relocated_python"
104
+ $relocatedPythonTool = Join-Path - Path $relocatedPython - ChildPath $artifactPath
105
+ $relocatedFullPath = Join-Path $relocatedPythonTool " bin" | Join-Path - ChildPath $pyfilename
106
+
107
+ # copy the current build to relocated_python
108
+ $toolCacheArtifact = Join-Path $env: RUNNER_TOOL_CACHE $artifactPath
109
+ moveAssets - source $toolCacheArtifact - destination $relocatedPythonTool
110
+ try {
111
+ # Verify that relocated Python works
112
+ $relocatedFullPath | Should - Exist
113
+ " $relocatedFullPath --version" | Should - ReturnZeroExitCode
114
+ " sudo $relocatedFullPath --version" | Should - ReturnZeroExitCode
115
+ }
116
+ finally {
117
+ # Revert the changes for other tests
118
+ moveAssets - source $relocatedPythonTool - destination $toolCacheArtifact
119
+ }
120
+ }
91
121
}
92
122
93
123
# Pyinstaller 3.5 does not support Python 3.8.0. Check issue https://github.com/pyinstaller/pyinstaller/issues/4311
0 commit comments