[gn build] Change python run lines to python3

macOS 12.3 no longer ships non-3 python.

Almost all of these scripts were launched by ninja, and the GN files
already told it to run them under python3, so this is a fairly small
change.  The main effect is that if you run them manually, you now
get the same behavior.

(A small set of scripts, gn.py, gen.py, sync_source_lists_from_cmake.py,
are for manual running.  For these, it is an actual change.)

Differential Revision: https://reviews.llvm.org/D122345
This commit is contained in:
Nico Weber 2022-03-23 15:42:22 -04:00
parent 3bfbb68e1e
commit 0ff3cc2087
12 changed files with 14 additions and 29 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""Runs tablegen."""
import subprocess

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""Converts a .exports file to a format consumable by linkers.

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""Symlinks, or on Windows copies, an existing file to a second location.

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""Helps to keep BUILD.gn files in sync with the corresponding CMakeLists.txt.
@ -14,8 +14,6 @@ commit for each cmake commit this merges. If an error is reported, the state
of HEAD is unspecified; run `git reset --hard origin/main` if this happens.
"""
from __future__ import print_function
from collections import defaultdict
import os
import re

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
r"""Emulates the bits of CMake's configure_file() function needed in LLVM.
The CMake build uses configure_file() for several things. This emulates that
@ -32,8 +32,6 @@ Fails if any of the KEY=VALUE arguments aren't needed for processing the
input file, or if the input file references keys that weren't passed in.
"""
from __future__ import print_function
import argparse
import os
import re

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python
from __future__ import print_function
#!/usr/bin/env python3
import argparse
import os

View File

@ -1,9 +1,7 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""Gets the current revision and writes it to VCSRevision.h."""
from __future__ import print_function
import argparse
import os
import subprocess

View File

@ -1,17 +1,12 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""Downloads a prebuilt gn binary to a place where gn.py can find it."""
from __future__ import print_function
import io
import os
try:
# In Python 3, we need the module urllib.reqest. In Python 2, this
# functionality was in the urllib2 module.
from urllib import request as urllib_request
except ImportError:
import urllib2 as urllib_request
import sys
import urllib.request
import zipfile
@ -19,7 +14,7 @@ def download_and_unpack(url, output_dir, gn):
"""Download an archive from url and extract gn from it into output_dir."""
print('downloading %s ...' % url, end='')
sys.stdout.flush()
data = urllib_request.urlopen(url).read()
data = urllib.request.urlopen(url).read()
print(' done')
zipfile.ZipFile(io.BytesIO(data)).extract(gn, path=output_dir)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""Calls `gn` with the right --dotfile= and --root= arguments for LLVM."""
# GN normally expects a file called '.gn' at the root of the repository.

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#===----------------------------------------------------------------------===##
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python
from __future__ import print_function
#!/usr/bin/env python3
import argparse
import os

View File

@ -1,8 +1,6 @@
#!/usr/bin/env python
#!/usr/bin/env python3
r"""Writes ExtensionDepencencies.inc."""
from __future__ import print_function
import argparse
import os
import re