mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-24 19:22:13 +01:00
Implement functions to get defaults for editor/pager.
These are platform specific, for example on Debian we want to use the ones provided by sensible-utils.
This commit is contained in:
parent
163b3e3dfa
commit
42b5f3961d
32
osc/core.py
32
osc/core.py
@ -2585,6 +2585,38 @@ def read_meta_from_spec(specfile, *args):
|
||||
|
||||
return spec_data
|
||||
|
||||
def get_default_editor():
|
||||
import platform
|
||||
system = platform.system()
|
||||
if system == 'Windows':
|
||||
return 'notepad'
|
||||
if system == 'Linux':
|
||||
try:
|
||||
# Python 2.6
|
||||
dist = platform.linux_distributionx()[0]
|
||||
except AttributeError:
|
||||
dist = platform.dist()[0]
|
||||
if dist == 'debian':
|
||||
return 'editor'
|
||||
return 'vim'
|
||||
return 'vi'
|
||||
|
||||
def get_default_pager():
|
||||
import platform
|
||||
system = platform.system()
|
||||
if system == 'Windows':
|
||||
return 'less'
|
||||
if system == 'Linux':
|
||||
try:
|
||||
# Python 2.6
|
||||
dist = platform.linux_distributionx()[0]
|
||||
except AttributeError:
|
||||
dist = platform.dist()[0]
|
||||
if dist == 'debian':
|
||||
return 'pager'
|
||||
return 'less'
|
||||
return 'more'
|
||||
|
||||
def run_pager(message):
|
||||
import tempfile, sys
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user