AdaCore / gnatcoll-bindings

GNAT Components Collection – Bindings to C libraries
Other
14 stars 15 forks source link

Ensure python3 used for python3/ #11

Open simonjwright opened 3 years ago

simonjwright commented 3 years ago

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!

asarhaddon commented 2 years ago

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

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