mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Disallow versionless Python shebangs (#58275)
Summary: Some machines don't have a versionless `python` on their PATH, which breaks these existing shebangs. I'm assuming that all the existing versionless `python` shebangs are meant to be `python3` and not `python2`; please let me know if my assumption was incorrect for any of these. Pull Request resolved: https://github.com/pytorch/pytorch/pull/58275 Test Plan: CI. Reviewed By: zhouzhuojie Differential Revision: D28428143 Pulled By: samestep fbshipit-source-id: 6562be3d12924db72a92a0207b060ef740f61ebf
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e6adc06221
commit
2e26976ad3
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import boto3
|
import boto3
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
2
.github/scripts/lint_native_functions.py
vendored
2
.github/scripts/lint_native_functions.py
vendored
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
'''
|
'''
|
||||||
Verify that it is possible to round-trip native_functions.yaml via ruamel under some
|
Verify that it is possible to round-trip native_functions.yaml via ruamel under some
|
||||||
configuration. Keeping native_functions.yaml consistent in this way allows us to
|
configuration. Keeping native_functions.yaml consistent in this way allows us to
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
'''
|
'''
|
||||||
This file verifies that the workflows that are potentially canceled in our cancel_redundant_workflow.yml
|
This file verifies that the workflows that are potentially canceled in our cancel_redundant_workflow.yml
|
||||||
match the workflows we have running on pull requests (found in .github/workflows). This way, anytime a
|
match the workflows we have running on pull requests (found in .github/workflows). This way, anytime a
|
||||||
|
4
.github/workflows/lint.yml
vendored
4
.github/workflows/lint.yml
vendored
@ -78,6 +78,10 @@ jobs:
|
|||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
(! git --no-pager grep -In $'#include "' -- ./c10 ./aten ./torch/csrc ':(exclude)aten/src/ATen/native/quantized/cpu/qnnpack/**' || (echo "The above lines have include with quotes; please convert them to #include <xxxx>"; false))
|
(! git --no-pager grep -In $'#include "' -- ./c10 ./aten ./torch/csrc ':(exclude)aten/src/ATen/native/quantized/cpu/qnnpack/**' || (echo "The above lines have include with quotes; please convert them to #include <xxxx>"; false))
|
||||||
|
- name: Ensure no versionless Python shebangs
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
(! git --no-pager grep -In '#!.*python$' -- . || (echo "The above lines have versionless Python shebangs; please specify either python2 or python3"; false))
|
||||||
- name: Ensure no unqualified noqa
|
- name: Ensure no unqualified noqa
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
|
1
Makefile
1
Makefile
@ -66,6 +66,7 @@ quick_checks:
|
|||||||
--step 'Ensure no tabs' \
|
--step 'Ensure no tabs' \
|
||||||
--step 'Ensure no non-breaking spaces' \
|
--step 'Ensure no non-breaking spaces' \
|
||||||
--step 'Ensure canonical include' \
|
--step 'Ensure canonical include' \
|
||||||
|
--step 'Ensure no versionless Python shebangs' \
|
||||||
--step 'Ensure no unqualified noqa' \
|
--step 'Ensure no unqualified noqa' \
|
||||||
--step 'Ensure no unqualified type ignore' \
|
--step 'Ensure no unqualified type ignore' \
|
||||||
--step 'Ensure no direct cub include' \
|
--step 'Ensure no direct cub include' \
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import ast
|
import ast
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/env python
|
#!/bin/env python3
|
||||||
|
|
||||||
# Copyright (c) 2016-present, Facebook, Inc.
|
# Copyright (c) 2016-present, Facebook, Inc.
|
||||||
#
|
#
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#! /usr/bin/env python
|
#! /usr/bin/env python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#! /usr/bin/env python
|
#! /usr/bin/env python3
|
||||||
|
|
||||||
import onnx.backend
|
import onnx.backend
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import copy
|
import copy
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
"""This script runs cuda-memcheck on the specified unit test. Each test case
|
"""This script runs cuda-memcheck on the specified unit test. Each test case
|
||||||
is run in its isolated process with a timeout so that:
|
is run in its isolated process with a timeout so that:
|
||||||
|
@ -489,7 +489,7 @@ class TestTesting(TestCase):
|
|||||||
def test_cuda_assert_should_stop_common_utils_test_suite(self, device):
|
def test_cuda_assert_should_stop_common_utils_test_suite(self, device):
|
||||||
# test to ensure common_utils.py override has early termination for CUDA.
|
# test to ensure common_utils.py override has early termination for CUDA.
|
||||||
stderr = TestCase.runWithPytorchAPIUsageStderr("""\
|
stderr = TestCase.runWithPytorchAPIUsageStderr("""\
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch.testing._internal.common_utils import (TestCase, run_tests, slowTest)
|
from torch.testing._internal.common_utils import (TestCase, run_tests, slowTest)
|
||||||
@ -522,7 +522,7 @@ if __name__ == '__main__':
|
|||||||
def test_cuda_assert_should_stop_common_device_type_test_suite(self, device):
|
def test_cuda_assert_should_stop_common_device_type_test_suite(self, device):
|
||||||
# test to ensure common_device_type.py override has early termination for CUDA.
|
# test to ensure common_device_type.py override has early termination for CUDA.
|
||||||
stderr = TestCase.runWithPytorchAPIUsageStderr("""\
|
stderr = TestCase.runWithPytorchAPIUsageStderr("""\
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch.testing._internal.common_utils import (TestCase, run_tests, slowTest)
|
from torch.testing._internal.common_utils import (TestCase, run_tests, slowTest)
|
||||||
@ -562,7 +562,7 @@ if __name__ == '__main__':
|
|||||||
def test_cuda_assert_should_not_stop_common_distributed_test_suite(self, device):
|
def test_cuda_assert_should_not_stop_common_distributed_test_suite(self, device):
|
||||||
# test to ensure common_distributed.py override should not early terminate CUDA.
|
# test to ensure common_distributed.py override should not early terminate CUDA.
|
||||||
stderr = TestCase.runWithPytorchAPIUsageStderr("""\
|
stderr = TestCase.runWithPytorchAPIUsageStderr("""\
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch.testing._internal.common_utils import (run_tests, slowTest)
|
from torch.testing._internal.common_utils import (run_tests, slowTest)
|
||||||
@ -698,7 +698,7 @@ class TestFrameworkUtils(TestCase):
|
|||||||
def test_filtering_env_var(self):
|
def test_filtering_env_var(self):
|
||||||
# Test environment variable selected device type test generator.
|
# Test environment variable selected device type test generator.
|
||||||
test_filter_file_template = """\
|
test_filter_file_template = """\
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch.testing._internal.common_utils import (TestCase, run_tests)
|
from torch.testing._internal.common_utils import (TestCase, run_tests)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
A driver script to run clang-tidy on changes detected via git.
|
A driver script to run clang-tidy on changes detected via git.
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from package.oss.cov_json import get_json_report
|
from package.oss.cov_json import get_json_report
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# ===- git-clang-format - ClangFormat Git Integration ---------*- python -*--===#
|
# ===- git-clang-format - ClangFormat Git Integration ---------*- python -*--===#
|
||||||
#
|
#
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (c) 2005-2010 ActiveState Software Inc.
|
# Copyright (c) 2005-2010 ActiveState Software Inc.
|
||||||
# Copyright (c) 2013 Eddy Petrișor
|
# Copyright (c) 2013 Eddy Petrișor
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
""" The Python Hipify script.
|
""" The Python Hipify script.
|
||||||
##
|
##
|
||||||
# Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved.
|
# Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
model_dump: a one-stop shop for TorchScript model inspection.
|
model_dump: a one-stop shop for TorchScript model inspection.
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
import sys
|
import sys
|
||||||
from . import main
|
from . import main
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user