options --help and --version should not require a backend to be present
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
disper |
New
|
Undecided
|
Unassigned |
Bug Description
If DISPLAY environment variable is unset, running disper with either --help or --version results in:
Traceback (most recent call last):
File "./disper.py", line 360, in <module>
main()
File "./disper.py", line 352, in main
disper = Disper()
File "./disper.py", line 54, in __init__
self.switcher = Switcher()
File "/tmp/dispercur
self.
File "/tmp/dispercur
raise Exception('No suitable backend found')
Exception: No suitable backend found
It turns out that at make stage 'help2man' needs to run src/disper.py with '--version' and '--help' options and capture its output. There are several situations where DISPLAY env variable may not be present at that time (in my case it was Gentoo's package manager). I solved the issue by explicitly checking for {'-h', '--help', '--version'} in sys.argv right after initializing the options. The patch is attached.
Disper: 0.3.0
Python: 2.7.2