Opened 2 months ago

Closed 7 weeks ago

#13540 closed Patch - Feature (fixed)

Feature patch - python bindings - remove errant shebangs from python library files

Reported by: Gary Buhrmaster Owned by: Bill Meek
Priority: minor Milestone: 31.0
Component: Bindings - Python Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Feature patch - python bindings - remove errant shebangs from python library files

Library files/modules that are going to be installed in the ..../site packages/ directory likely should not have a shebang at all (they are to imported, they are not executable).  In the MythtV code base there is a mixture of python binding library files with and without the shebang that are installed in the ..../site-packages/ directory.  While the shebangs are essentially useless (the files are not set executable as part of the installation performed by setup.py in my tests), I would propose that they should probably be cleaned up in the source code base to minimize any possible confusion moving forward (and to reduce unnecessary python file fixups by distro maintainers).  Note that a few of the files have a main section for test purposes, but since the file is non execuable, to test it one will have needed to invoke it via the direct python3 command anyway, so there is should be no change in functionality.

Note that this also results in the cleans up a set of files with the misuse of /usr/bin/env, which is strongly discouraged for system installed files (/usr/bin/env is fine for personal work, but discouraged, and some distros explicitly prohibit such files to avoid non-reproduability based on a users flavor of the day).

Yet another really (really) trivial/low priority/severity source cleanup ticket (but ticket protocol says I should not set the priority/severity for new tickets, so it ends up being minor/medium, sorry).

Proposed patch to remove shebangs from bindings package modules:

diff --git a/mythtv/bindings/python/MythTV/__init__.py b/mythtv/bindings/python/MythTV/__init__.py
index 2f92d96830..b9bf6c301d 100644
--- a/mythtv/bindings/python/MythTV/__init__.py
+++ b/mythtv/bindings/python/MythTV/__init__.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 
 __all_exceptions__  = ['MythError', 'MythDBError', 'MythBEError', \
                        'MythFEError', 'MythFileError', 'MythTZError']
diff --git a/mythtv/bindings/python/MythTV/ttvdb/tvdbXslt.py b/mythtv/bindings/python/MythTV/ttvdb/tvdbXslt.py
index cd34f93a9b..f4dc9ca107 100755
--- a/mythtv/bindings/python/MythTV/ttvdb/tvdbXslt.py
+++ b/mythtv/bindings/python/MythTV/ttvdb/tvdbXslt.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: UTF-8 -*-
 # ----------------------
 # Name: tvdbXslt - XPath and XSLT functions for the tvdb.py XML output
diff --git a/mythtv/bindings/python/MythTV/ttvdb/tvdb_api.py b/mythtv/bindings/python/MythTV/ttvdb/tvdb_api.py
index bb98b0a70c..01b13c7ebc 100644
--- a/mythtv/bindings/python/MythTV/ttvdb/tvdb_api.py
+++ b/mythtv/bindings/python/MythTV/ttvdb/tvdb_api.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # encoding:utf-8
 # author:dbr/Ben
 # project:tvdb_api
diff --git a/mythtv/bindings/python/MythTV/ttvdb/tvdb_exceptions.py b/mythtv/bindings/python/MythTV/ttvdb/tvdb_exceptions.py
index bf59b28982..edf2413551 100644
--- a/mythtv/bindings/python/MythTV/ttvdb/tvdb_exceptions.py
+++ b/mythtv/bindings/python/MythTV/ttvdb/tvdb_exceptions.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 #encoding:utf-8
 #author:dbr/Ben
 #project:tvdb_api
diff --git a/mythtv/bindings/python/MythTV/ttvdb/tvdb_ui.py b/mythtv/bindings/python/MythTV/ttvdb/tvdb_ui.py
index 9f9e417d06..d9936bb1c5 100644
--- a/mythtv/bindings/python/MythTV/ttvdb/tvdb_ui.py
+++ b/mythtv/bindings/python/MythTV/ttvdb/tvdb_ui.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 #encoding:utf-8
 #author:dbr/Ben
 #project:tvdb_api
diff --git a/mythtv/bindings/python/MythTV/utility/dicttoxml.py b/mythtv/bindings/python/MythTV/utility/dicttoxml.py
index 4ad258449f..f856cacc60 100644
--- a/mythtv/bindings/python/MythTV/utility/dicttoxml.py
+++ b/mythtv/bindings/python/MythTV/utility/dicttoxml.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # coding: utf-8
 
 """
diff --git a/mythtv/bindings/python/MythTV/wikiscripts/__init__.py b/mythtv/bindings/python/MythTV/wikiscripts/__init__.py
index 94718a5409..cbc611a36b 100644
--- a/mythtv/bindings/python/MythTV/wikiscripts/__init__.py
+++ b/mythtv/bindings/python/MythTV/wikiscripts/__init__.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 
 from .wikiscripts import *
 
diff --git a/mythtv/bindings/python/MythTV/wikiscripts/wikiscripts.py b/mythtv/bindings/python/MythTV/wikiscripts/wikiscripts.py
index 2f02d1923e..08853641c1 100644
--- a/mythtv/bindings/python/MythTV/wikiscripts/wikiscripts.py
+++ b/mythtv/bindings/python/MythTV/wikiscripts/wikiscripts.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: UTF-8 -*-
 #----------------------
 
diff --git a/mythtv/bindings/python/tmdb3/scripts/populate_locale.py b/mythtv/bindings/python/tmdb3/scripts/populate_locale.py
index 2f6ec6e553..cce76ff031 100755
--- a/mythtv/bindings/python/tmdb3/scripts/populate_locale.py
+++ b/mythtv/bindings/python/tmdb3/scripts/populate_locale.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 #-----------------------
 # Name: populate_locale.py    Helper for grabbing ISO639 and ISO3316 data
diff --git a/mythtv/bindings/python/tmdb3/scripts/pytmdb3.py b/mythtv/bindings/python/tmdb3/scripts/pytmdb3.py
index 00df92cd9a..820831f670 100755
--- a/mythtv/bindings/python/tmdb3/scripts/pytmdb3.py
+++ b/mythtv/bindings/python/tmdb3/scripts/pytmdb3.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 
 from optparse import OptionParser
 from tmdb3 import *
diff --git a/mythtv/bindings/python/tmdb3/tmdb3/__init__.py b/mythtv/bindings/python/tmdb3/tmdb3/__init__.py
index 83c20cf3fe..6cbe73d345 100644
--- a/mythtv/bindings/python/tmdb3/tmdb3/__init__.py
+++ b/mythtv/bindings/python/tmdb3/tmdb3/__init__.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 
 import sys
 IS_PY2 = sys.version_info[0] == 2
diff --git a/mythtv/bindings/python/tmdb3/tmdb3/cache.py b/mythtv/bindings/python/tmdb3/tmdb3/cache.py
index 9122ef21ed..9c211cf352 100644
--- a/mythtv/bindings/python/tmdb3/tmdb3/cache.py
+++ b/mythtv/bindings/python/tmdb3/tmdb3/cache.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 #-----------------------
 # Name: cache.py
diff --git a/mythtv/bindings/python/tmdb3/tmdb3/cache_engine.py b/mythtv/bindings/python/tmdb3/tmdb3/cache_engine.py
index 150bb1eab1..4b5369255a 100644
--- a/mythtv/bindings/python/tmdb3/tmdb3/cache_engine.py
+++ b/mythtv/bindings/python/tmdb3/tmdb3/cache_engine.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 #-----------------------
 # Name: cache_engine.py
diff --git a/mythtv/bindings/python/tmdb3/tmdb3/cache_file.py b/mythtv/bindings/python/tmdb3/tmdb3/cache_file.py
index 85455b7c55..e2f6165ac8 100644
--- a/mythtv/bindings/python/tmdb3/tmdb3/cache_file.py
+++ b/mythtv/bindings/python/tmdb3/tmdb3/cache_file.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 #-----------------------
 # Name: cache_file.py
diff --git a/mythtv/bindings/python/tmdb3/tmdb3/cache_null.py b/mythtv/bindings/python/tmdb3/tmdb3/cache_null.py
index 0a20ae0d18..8eaee8a689 100644
--- a/mythtv/bindings/python/tmdb3/tmdb3/cache_null.py
+++ b/mythtv/bindings/python/tmdb3/tmdb3/cache_null.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 #-----------------------
 # Name: cache_null.py
diff --git a/mythtv/bindings/python/tmdb3/tmdb3/locales.py b/mythtv/bindings/python/tmdb3/tmdb3/locales.py
index 319f26251a..c63adeb005 100644
--- a/mythtv/bindings/python/tmdb3/tmdb3/locales.py
+++ b/mythtv/bindings/python/tmdb3/tmdb3/locales.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 #-----------------------
 # Name: locales.py    Stores locale information for filtering results
diff --git a/mythtv/bindings/python/tmdb3/tmdb3/pager.py b/mythtv/bindings/python/tmdb3/tmdb3/pager.py
index 64c0a583f5..6fb9d91a8f 100644
--- a/mythtv/bindings/python/tmdb3/tmdb3/pager.py
+++ b/mythtv/bindings/python/tmdb3/tmdb3/pager.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 #-----------------------
 # Name: pager.py    List-like structure designed for handling paged results
diff --git a/mythtv/bindings/python/tmdb3/tmdb3/request.py b/mythtv/bindings/python/tmdb3/tmdb3/request.py
index d87503e5a8..9abf83f7b2 100644
--- a/mythtv/bindings/python/tmdb3/tmdb3/request.py
+++ b/mythtv/bindings/python/tmdb3/tmdb3/request.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 #-----------------------
 # Name: tmdb_request.py
diff --git a/mythtv/bindings/python/tmdb3/tmdb3/tmdb_api.py b/mythtv/bindings/python/tmdb3/tmdb3/tmdb_api.py
index 89ceb84983..d7897f302a 100644
--- a/mythtv/bindings/python/tmdb3/tmdb3/tmdb_api.py
+++ b/mythtv/bindings/python/tmdb3/tmdb3/tmdb_api.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 #-----------------------
 # Name: tmdb_api.py    Simple-to-use Python interface to TMDB's API v3
diff --git a/mythtv/bindings/python/tmdb3/tmdb3/tmdb_auth.py b/mythtv/bindings/python/tmdb3/tmdb3/tmdb_auth.py
index 030838c7f5..659f3501da 100644
--- a/mythtv/bindings/python/tmdb3/tmdb3/tmdb_auth.py
+++ b/mythtv/bindings/python/tmdb3/tmdb3/tmdb_auth.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 #-----------------------
 # Name: tmdb_auth.py
diff --git a/mythtv/bindings/python/tmdb3/tmdb3/tmdb_exceptions.py b/mythtv/bindings/python/tmdb3/tmdb3/tmdb_exceptions.py
index 5020c4ab1a..13620f119f 100644
--- a/mythtv/bindings/python/tmdb3/tmdb3/tmdb_exceptions.py
+++ b/mythtv/bindings/python/tmdb3/tmdb3/tmdb_exceptions.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 #-----------------------
 # Name: tmdb_exceptions.py    Common exceptions used in tmdbv3 API library
diff --git a/mythtv/bindings/python/tmdb3/tmdb3/util.py b/mythtv/bindings/python/tmdb3/tmdb3/util.py
index 18f88347fd..5f3a9194ef 100644
--- a/mythtv/bindings/python/tmdb3/tmdb3/util.py
+++ b/mythtv/bindings/python/tmdb3/tmdb3/util.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 #-----------------------
 # Name: util.py    Assorted utilities used in tmdb_api

Change History (2)

comment:1 Changed 2 months ago by Bill Meek

Milestone: needs_triage31.0
Status: newaccepted

comment:2 Changed 7 weeks ago by Gary Buhrmaster <gary.buhrmaster@…>

Resolution: fixed
Status: acceptedclosed

In 8dce45294c/mythtv:

HTML/Python Tidy: Clean up various file modes/shebangs

Removes execute permissions where not needed and shebangs probably
left from testing. Based on three tickets.

Closes #13537
Closes #13539
Closes #13540

Signed-off-by: Bill Meek <billmeek@…>

Note: See TracTickets for help on using tickets.