Skip to content

Commit 473fa53

Browse files
committed
Teach use-python-version.py about other architectures
1 parent 00d989f commit 473fa53

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

.azure-pipelines/install_python_version.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,35 +80,35 @@ def install_selected_python_version(installer_url, installer_folder):
8080
exit(1)
8181

8282

83-
def get_installer_url(requested_version, version_manifest):
83+
def get_installer_url(requested_version, requested_arch, version_manifest):
8484
current_plat = platform.system().lower()
8585

8686
print("Current Platform Is {}".format(platform.platform()))
8787

8888
if version_manifest[requested_version]:
8989
found_installers = version_manifest[requested_version]["files"]
9090

91-
# filter anything that's not x64. we don't care.
92-
x64_installers = [
93-
file_def for file_def in found_installers if file_def["arch"] == "x64"
91+
# filter anything that's not our requested architecture.
92+
arch_installers = [
93+
file_def for file_def in found_installers if file_def["arch"] == requested_arch
9494
]
9595

9696
if current_plat == "windows":
9797
return [
9898
installer
99-
for installer in x64_installers
99+
for installer in arch_installers
100100
if installer["platform"] == "win32"
101101
][0]
102102
elif current_plat == "darwin":
103103
return [
104104
installer
105-
for installer in x64_installers
105+
for installer in arch_installers
106106
if installer["platform"] == current_plat
107107
][0]
108108
else:
109109
return [
110110
installer
111-
for installer in x64_installers
111+
for installer in arch_installers
112112
if installer["platform"] == "linux"
113113
and installer["platform_version"] == CURRENT_UBUNTU_VERSION
114114
][0]
@@ -125,6 +125,13 @@ def get_installer_url(requested_version, version_manifest):
125125
help=("The version specifier passed in to the UsePythonVersion extended task."),
126126
)
127127

128+
parser.add_argument(
129+
"--arch",
130+
dest="arch",
131+
default="x64",
132+
help=("The architecture passed in to the UsePythonVersion extended task."),
133+
)
134+
128135
parser.add_argument(
129136
"--installer_folder",
130137
dest="installer_folder",
@@ -152,7 +159,7 @@ def get_installer_url(requested_version, version_manifest):
152159
args.version_spec
153160
)
154161
)
155-
install_file_details = get_installer_url(args.version_spec, version_dict)
162+
install_file_details = get_installer_url(args.version_spec, args.arch, version_dict)
156163
install_selected_python_version(
157164
install_file_details["download_url"], args.installer_folder
158-
)
165+
)

.azure-pipelines/use-python-version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ steps:
1717
displayName: 'Check Version Spec Against Known Versions'
1818
inputs:
1919
scriptPath: '.azure-pipelines/install_python_version.py'
20-
arguments: '${{ parameters.versionSpec }} --installer_folder="../_pyinstaller'
20+
arguments: '${{ parameters.versionSpec }} --arch ${{ parameters.architecture }} --installer_folder="../_pyinstaller'
2121

2222
# use
2323
- task: UsePythonVersion@0

0 commit comments

Comments
 (0)