Skip to content

Commit 595cae7

Browse files
authored
Make build-script-helper.py use python3 (#956)
By aiming to update the Node version to 22.17.0 on Swift Docker for Swift DocC Render [1], we need to specify the version 3 of python, otherwise it will try to use python 2 which it's not available in Node 22. Resolves: rdar://156708326 [1] swiftlang/swift-docker#487
1 parent 2668aa4 commit 595cae7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

build-script-helper.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
"""
44
This source file is part of the Swift.org open source project
@@ -13,8 +13,6 @@
1313
knows how to build and install the swift-docc-render.
1414
"""
1515

16-
from __future__ import print_function
17-
1816
import argparse
1917
import os
2018
import platform
@@ -75,7 +73,10 @@ def ensure_npm_is_installed(verbose=False):
7573
fatal_error('-- Error: %s' % error_msg)
7674
try:
7775
node_version = check_output(['node', '--version'], verbose=verbose)
78-
if not node_version.startswith('v18.16.'):
76+
# Ensure node_version is a string (decode if it's bytes)
77+
if isinstance(node_version, bytes):
78+
node_version = node_version.decode('utf-8')
79+
if not node_version.strip().startswith('v18.16.'):
7980
warn_msg = "Unexpected version of 'node' installed. Swift-DocC-Render requires node 18.16.1. "\
8081
"See the README.md file for more information about building Swift-DocC-Render."
8182
printerr('-- Warning: %s' % warn_msg)

0 commit comments

Comments
 (0)