diff --git a/llvm/utils/gn/build/run_tablegen.py b/llvm/utils/gn/build/run_tablegen.py --- a/llvm/utils/gn/build/run_tablegen.py +++ b/llvm/utils/gn/build/run_tablegen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Runs tablegen.""" import subprocess diff --git a/llvm/utils/gn/build/symbol_exports.py b/llvm/utils/gn/build/symbol_exports.py --- a/llvm/utils/gn/build/symbol_exports.py +++ b/llvm/utils/gn/build/symbol_exports.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Converts a .exports file to a format consumable by linkers. diff --git a/llvm/utils/gn/build/symlink_or_copy.py b/llvm/utils/gn/build/symlink_or_copy.py --- a/llvm/utils/gn/build/symlink_or_copy.py +++ b/llvm/utils/gn/build/symlink_or_copy.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Symlinks, or on Windows copies, an existing file to a second location. diff --git a/llvm/utils/gn/build/sync_source_lists_from_cmake.py b/llvm/utils/gn/build/sync_source_lists_from_cmake.py --- a/llvm/utils/gn/build/sync_source_lists_from_cmake.py +++ b/llvm/utils/gn/build/sync_source_lists_from_cmake.py @@ -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 @@ 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 diff --git a/llvm/utils/gn/build/write_cmake_config.py b/llvm/utils/gn/build/write_cmake_config.py --- a/llvm/utils/gn/build/write_cmake_config.py +++ b/llvm/utils/gn/build/write_cmake_config.py @@ -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 @@ 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 diff --git a/llvm/utils/gn/build/write_library_dependencies.py b/llvm/utils/gn/build/write_library_dependencies.py --- a/llvm/utils/gn/build/write_library_dependencies.py +++ b/llvm/utils/gn/build/write_library_dependencies.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -from __future__ import print_function +#!/usr/bin/env python3 import argparse import os diff --git a/llvm/utils/gn/build/write_vcsrevision.py b/llvm/utils/gn/build/write_vcsrevision.py --- a/llvm/utils/gn/build/write_vcsrevision.py +++ b/llvm/utils/gn/build/write_vcsrevision.py @@ -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 diff --git a/llvm/utils/gn/get.py b/llvm/utils/gn/get.py --- a/llvm/utils/gn/get.py +++ b/llvm/utils/gn/get.py @@ -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 @@ """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) diff --git a/llvm/utils/gn/gn.py b/llvm/utils/gn/gn.py --- a/llvm/utils/gn/gn.py +++ b/llvm/utils/gn/gn.py @@ -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. diff --git a/llvm/utils/gn/secondary/libcxx/utils/gen_link_script.py b/llvm/utils/gn/secondary/libcxx/utils/gen_link_script.py --- a/llvm/utils/gn/secondary/libcxx/utils/gen_link_script.py +++ b/llvm/utils/gn/secondary/libcxx/utils/gen_link_script.py @@ -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. diff --git a/llvm/utils/gn/secondary/llvm/include/llvm/Support/write_extension_def.py b/llvm/utils/gn/secondary/llvm/include/llvm/Support/write_extension_def.py --- a/llvm/utils/gn/secondary/llvm/include/llvm/Support/write_extension_def.py +++ b/llvm/utils/gn/secondary/llvm/include/llvm/Support/write_extension_def.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -from __future__ import print_function +#!/usr/bin/env python3 import argparse import os diff --git a/llvm/utils/gn/secondary/llvm/tools/llvm-config/write_extension_dependencies.py b/llvm/utils/gn/secondary/llvm/tools/llvm-config/write_extension_dependencies.py --- a/llvm/utils/gn/secondary/llvm/tools/llvm-config/write_extension_dependencies.py +++ b/llvm/utils/gn/secondary/llvm/tools/llvm-config/write_extension_dependencies.py @@ -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