cliff apps fail to detect command name when called apps are called as python modules

Bug #1779218 reported by Sorin Sbarnea
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cliff
Fix Released
Undecided
Sorin Sbarnea

Bug Description

Python has one standard way to call modules as scripts, via `python -m modulename`. When this is done python is calling modulename/__main__.py as a script.

Most python based tools do support this (pip, flake8, tox, ...) but apperently cliff does not.

First this should be added to demoapp and we also need to assure that one bug is sorted because at this moment, people may face an undexpected bug:

>modulename --version
modulename 1.2.3

>python -m modulename --version
__main__ 1.2.3

This is caused by the code inside cliff which assumes that the command name is taken from sys.argv[0], which in case of module calling, is not really useful.

This may seem as a minor bug but because cliff is used by so many tools, it prevents their users from implementing the module calling correctly and we should fix it ASAP.

Revision history for this message
Sorin Sbarnea (ssbarnea) wrote :
Changed in python-cliff:
assignee: nobody → Sorin Sbarnea (ssbarnea)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cliff 2.13.0

This issue was fixed in the openstack/cliff 2.13.0 release.

Sorin Sbarnea (ssbarnea)
Changed in python-cliff:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.