Skip to content

Resolve usage of shebangs for Python scripts

Karl Wette requested to merge (removed):remove-usr-bin-env-python into master

Description

Adds a CI job lint:shebang to implement the following policy:

  • Python scripts with a .py extension must not contain a shebang. Such scripts are usually run as part of the build system, e.g. as test scripts, and so are run by the configured Python instance in PYTHON. So a shebang is not needed.
  • Python scripts without a .py extension must not use an absolute Python path. These should only be scripts which are not run as part of the build system, e.g. pipeline scripts, scripts to regenerate reference results or plots, etc. These scripts should at least use #!/usr/bin/env python....

Remaining scripts implement this policy:

  • Shebangs from Python scripts with a .py extension are removed.
  • The make_frame_cache script run from test_hetrodyne_pulsar is now run by the configured PYTHON
  • Some LALApps scripts which look useful are now properly installed through the LALApps build system, which deals with running Python scripts using the configured PYTHON
  • Otherwise scripts have been made standalone executables, without a .py extension and a #!/usr/bin/env python... shebang.

Closes #423 (closed)

API Changes and Justification

Backwards Compatible Changes

  • This change introduces no API changes
  • This change adds new API calls

Backwards Incompatible Changes

  • This change modifies an existing API
  • This change removes an existing API

Review Status

N/A

Merge request reports