Skip to content

Make build-script-helper.py use python3 #956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions build-script-helper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this script run in the CI tests for pull requests?

(Just making sure so we can ensure that whatever tool using this script actually does have python 3 installed and there are no syntax issues with this script when running with 3 vs 2.)


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

from __future__ import print_function

import argparse
import os
import platform
Expand Down Expand Up @@ -75,7 +73,10 @@ def ensure_npm_is_installed(verbose=False):
fatal_error('-- Error: %s' % error_msg)
try:
node_version = check_output(['node', '--version'], verbose=verbose)
if not node_version.startswith('v18.16.'):
# Ensure node_version is a string (decode if it's bytes)
if isinstance(node_version, bytes):
node_version = node_version.decode('utf-8')
if not node_version.strip().startswith('v18.16.'):
warn_msg = "Unexpected version of 'node' installed. Swift-DocC-Render requires node 18.16.1. "\
"See the README.md file for more information about building Swift-DocC-Render."
printerr('-- Warning: %s' % warn_msg)
Expand Down