mirror of
https://github.com/powerline/powerline.git
synced 2025-07-26 23:35:04 +02:00
Show exception in setup.py and try to fall back to powerline.sh
This commit is contained in:
parent
95dcef8bf8
commit
925d3eb0e4
24
setup.py
24
setup.py
@ -4,6 +4,7 @@ from __future__ import unicode_literals
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import logging
|
||||||
|
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
@ -28,11 +29,26 @@ def compile_client():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
compile_client()
|
compile_client()
|
||||||
except Exception:
|
except Exception as e:
|
||||||
|
print('Compiling C version of powerline-client failed')
|
||||||
|
logging.exception(e)
|
||||||
# FIXME Catch more specific exceptions
|
# FIXME Catch more specific exceptions
|
||||||
import shutil
|
import shutil
|
||||||
print('Compiling C version of powerline-client failed, using Python version instead')
|
if hasattr(shutil, 'which'):
|
||||||
|
which = shutil.which
|
||||||
|
else:
|
||||||
|
sys.path.append(CURRENT_DIR)
|
||||||
|
from powerline.lib import which
|
||||||
|
if which('socat') and which('sed') and which('sh'):
|
||||||
|
print('Using powerline.sh script instead of C version (requires socat, sed and sh)')
|
||||||
|
shutil.copyfile('client/powerline.sh', 'scripts/powerline')
|
||||||
|
can_use_scripts = True
|
||||||
|
else:
|
||||||
|
print('Using powerline.py script instead of C version')
|
||||||
shutil.copyfile('client/powerline.py', 'scripts/powerline')
|
shutil.copyfile('client/powerline.py', 'scripts/powerline')
|
||||||
|
can_use_scripts = True
|
||||||
|
else:
|
||||||
|
can_use_scripts = False
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='Powerline',
|
name='Powerline',
|
||||||
@ -66,8 +82,8 @@ setup(
|
|||||||
'scripts/powerline-daemon',
|
'scripts/powerline-daemon',
|
||||||
'scripts/powerline-render',
|
'scripts/powerline-render',
|
||||||
'scripts/powerline-config',
|
'scripts/powerline-config',
|
||||||
],
|
] + (['scripts/powerline'] if can_use_scripts else []),
|
||||||
data_files=[('bin', ['scripts/powerline'])],
|
data_files=(None if can_use_scripts else (('bin', ['scripts/powerline']),)),
|
||||||
keywords='',
|
keywords='',
|
||||||
packages=find_packages(exclude=('tests', 'tests.*')),
|
packages=find_packages(exclude=('tests', 'tests.*')),
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user