Skip to content

Commit

Permalink
Python shebang modernisation for python3
Browse files Browse the repository at this point in the history
PEP-394 recommends specifying python2 or python3 in shebangs unless the
script is known to only run in an activated virtual environment.

PEP-394 also says distributors may not provide the python command.
Newer versions of Ubuntu, at least, no longer provide python unless the
python-is-python3 package is explicitly installed.

Removed some shebangs from testcases (the test-suite does not need them).
  • Loading branch information
wsfulton committed Sep 22, 2024
1 parent 19ebbda commit 583e63b
Show file tree
Hide file tree
Showing 13 changed files with 9 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Doc/Manual/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ HTMLDOC_OPTIONS = "--book --toclevels 4 --no-numbered --toctitle \"Table of Cont
all: maketoc check generate

maketoc:
python maketoc.py
python3 maketoc.py

# Use this to regenerate CCache.html should this ever be needed
CCache.html: ../../CCache/ccache.yo
Expand All @@ -48,7 +48,7 @@ generate: SWIGDocumentation.html

SWIGDocumentation.html: swightml.book
htmldoc --batch swightml.book || true
python fixstyle.py SWIGDocumentation.html
python3 fixstyle.py SWIGDocumentation.html

swightml.book: chapters Sections.html
echo "#HTMLDOC 1.8.24" > swightml.book
Expand Down
2 changes: 1 addition & 1 deletion Doc/Manual/Python.html
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ <H3><a name="Python_nn6">33.2.2 Using distutils</a></H3>

<div class="code">
<pre>
#!/usr/bin/env python
#!/usr/bin/env python3

"""
setup.py file for SWIG example
Expand Down
2 changes: 1 addition & 1 deletion Doc/Manual/fixstyle.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

# Replace the inline htmldoc stylesheet with the SWIG stylesheet

Expand Down
2 changes: 1 addition & 1 deletion Doc/Manual/makechap.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

###############################################################################
# Takes a chapter as input and adds internal links and numbering to all
Expand Down
2 changes: 1 addition & 1 deletion Doc/Manual/maketoc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import sys
import os
Expand Down
1 change: 0 additions & 1 deletion Examples/test-suite/javascript/operbool_runme.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
var operbool = require("operbool");
const b = new operbool.Test();
if (b.operator_bool()) {
Expand Down
1 change: 0 additions & 1 deletion Examples/test-suite/python/cpp_static_runme.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/evn python
from cpp_static import *


Expand Down
1 change: 0 additions & 1 deletion Examples/test-suite/python/keyword_rename_c_runme.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
import keyword_rename_c
keyword_rename_c._in(1)
keyword_rename_c._except(1)
1 change: 0 additions & 1 deletion Examples/test-suite/python/keyword_rename_runme.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
import keyword_rename
keyword_rename._in(1)
keyword_rename._in(_except=1)
Expand Down
1 change: 0 additions & 1 deletion Examples/test-suite/python/operbool_runme.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
import operbool
if operbool.Test():
raise RuntimeError("operbool failed")
2 changes: 1 addition & 1 deletion Tools/obs-buildlogs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import os
import subprocess
Expand Down
2 changes: 1 addition & 1 deletion Tools/pyname_patch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
"""
From SWIG 1.3.37 we deprecated all SWIG symbols that start with Py,
since they are inappropriate and discouraged in Python documentation
Expand Down
2 changes: 1 addition & 1 deletion Tools/testflags.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

def get_cflags(language, std, compiler):
if std == None or len(std) == 0:
Expand Down

0 comments on commit 583e63b

Please sign in to comment.