Skip to content

Conversation

simonjwright
Copy link

If you’re on macOS Big Sur (not sure about earlier releases) and haven’t installed a Python 3, /usr/bin/python is 2.7.16 and /usr/bin/python3 is 3.8.2.

Of course, if you’re in a python3 virtual environment, python will mean python3, but should we rely on that? python3/tests/testsuite.py doesn’t!

  * python3/setup.py: call up python3 in the shebang line.
@asarhaddon
Copy link
Contributor

Hello.
I doubt that this can be applied upstream, but just in case:

  • there remains a lot of other python shebangs
  • some interpreters are launched from Ada

For the record, here is what we do in Debian.

--- a/gen_gps_help.py                                                                                                                                                                                                                          
+++ b/gen_gps_help.py                                                                                                                                                                                                                          
@@ -1,4 +1,4 @@
-#!/usr/bin/env python                                                                                                                                                                                                                         
+#!/usr/bin/python3                                                                                                                                                                                                                            
 
 import os
 import os.path
--- a/gmp/setup.py                                                                                                                                                                                                                             
+++ b/gmp/setup.py                                                                                                                                                                                                                             
@@ -1,4 +1,4 @@
-#!/usr/bin/env python                                                                                                                                                                                                                         
+#!/usr/bin/python3                                                                                                                                                                                                                            
 import logging
 import os
 import sys
--- a/iconv/setup.py                                                                                                                                                                                                                           
+++ b/iconv/setup.py                                                                                                                                                                                                                           
@@ -1,4 +1,4 @@
-#!/usr/bin/env python                                                                                                                                                                                                                         
+#!/usr/bin/python3                                                                                                                                                                                                                            
 import logging
 import os
 import sys
--- a/lzma/setup.py                                                                                                                                                                                                                            
+++ b/lzma/setup.py                                                                                                                                                                                                                            
@@ -1,4 +1,4 @@
-#!/usr/bin/env python                                                                                                                                                                                                                         
+#!/usr/bin/python3                                                                                                                                                                                                                            
 import logging
 import os
 import sys
--- a/omp/setup.py                                                                                                                                                                                                                             
+++ b/omp/setup.py                                                                                                                                                                                                                             
@@ -1,4 +1,4 @@
-#!/usr/bin/env python                                                                                                                                                                                                                         
+#!/usr/bin/python3                                                                                                                                                                                                                            
 import logging
 import os
 import sys
--- a/python/gnatcoll-scripts-python.adb                                                                                                                                                                                                       
+++ b/python/gnatcoll-scripts-python.adb                                                                                                                                                                                                       
@@ -532,7 +532,7 @@
    procedure Register_Python_Scripting
      (Repo          : access Scripts.Scripts_Repository_Record'Class;
       Module        : String;
-      Program_Name  : String := "python";                                                                                                                                                                                                     
+      Program_Name  : String := "python3";                                                                                                                                                                                                    
       Python_Home   : String := "")
    is
       Script  : Python_Scripting;
--- a/python/gnatcoll-scripts-python.ads                                                                                                                                                                                                       
+++ b/python/gnatcoll-scripts-python.ads                                                                                                                                                                                                       
@@ -34,7 +34,7 @@
    procedure Register_Python_Scripting
      (Repo         : access Scripts.Scripts_Repository_Record'Class;
       Module       : String;
-      Program_Name : String := "python";                                                                                                                                                                                                      
+      Program_Name : String := "python3";                                                                                                                                                                                                     
       Python_Home  : String := "");
    --  All commands and classes will be added in the specified module.
    --
--- a/python/setup.py                                                                                                                                                                                                                          
+++ b/python/setup.py                                                                                                                                                                                                                          
@@ -1,4 +1,4 @@
-#!/usr/bin/env python                                                                                                                                                                                                                         
+#!/usr/bin/python3                                                                                                                                                                                                                            
 import logging
 import sys
 import re
--- a/python3/setup.py                                                                                                                                                                                                                         
+++ b/python3/setup.py                                                                                                                                                                                                                         
@@ -1,4 +1,4 @@
-#!/usr/bin/env python                                                                                                                                                                                                                         
+#!/usr/bin/python3                                                                                                                                                                                                                            
 import logging
 import sys
 import re
--- a/readline/setup.py                                                                                                                                                                                                                        
+++ b/readline/setup.py                                                                                                                                                                                                                        
@@ -1,4 +1,4 @@
-#!/usr/bin/env python                                                                                                                                                                                                                         
+#!/usr/bin/python3                                                                                                                                                                                                                            
 import logging
 import os
 import sys
--- a/setup_support.py                                                                                                                                                                                                                         
+++ b/setup_support.py                                                                                                                                                                                                                         
@@ -1,4 +1,4 @@
-#!/usr/bin/env python                                                                                                                                                                                                                         
+#!/usr/bin/python3                                                                                                                                                                                                                            
 from subprocess import check_output, check_call, CalledProcessError
 import argparse
 import json
--- a/syslog/setup.py                                                                                                                                                                                                                          
+++ b/syslog/setup.py                                                                                                                                                                                                                          
@@ -1,4 +1,4 @@
-#!/usr/bin/env python                                                                                                                                                                                                                         
+#!/usr/bin/python3                                                                                                                                                                                                                            
 import logging
 import os
 import sys
--- a/testsuite/run-tests                                                                                                                                                                                                                      
+++ b/testsuite/run-tests                                                                                                                                                                                                                      
@@ -1,4 +1,4 @@
-#!/usr/bin/env python                                                                                                                                                                                                                         
+#!/usr/bin/python3                                                                                                                                                                                                                            
 from drivers import make_gnatcoll, TESTSUITE_ROOT_DIR
 from drivers.basic import BasicTestDriver
 from drivers.json_validation import JSONValidationDriver
--- a/zlib/setup.py                                                                                                                                                                                                                            
+++ b/zlib/setup.py                                                                                                                                                                                                                            
@@ -1,4 +1,4 @@
-#!/usr/bin/env python                                                                                                                                                                                                                         
+#!/usr/bin/python3                                                                                                                                                                                                                            
 import logging
 import os
 import sys

@t-14 t-14 requested a review from Nikokrock August 14, 2022 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants