Browse Source

Fix sudo os.getenv(XDG_DATA_DIRS) problem

doc-issue-template
MrS0m30n3 10 years ago
parent
commit
309a4b8dd4
1 changed files with 13 additions and 11 deletions
  1. 24
      setup.py

24
setup.py

@ -54,14 +54,13 @@ py2exe_dependencies = [
# Set icons path # Set icons path
if PY2EXE: if PY2EXE:
icons_path = 'icons' icons_path = 'icons'
fallback_icons_path = ''
else: else:
# On windows you have to copy the icons manually if you dont use py2exe # On windows you have to copy the icons manually if you dont use py2exe
xdg_data_dirs = os.getenv('XDG_DATA_DIRS')
icons_path = '/usr/local/share/icons/hicolor/'
if xdg_data_dirs is None:
icons_path = '/usr/share/pixmaps/'
else:
icons_path = '/usr/local/share/icons/hicolor/'
fallback_icons_path = '/usr/share/pixmaps/'
# Set params # Set params
if PY2EXE: if PY2EXE:
@ -78,12 +77,15 @@ if PY2EXE:
else: else:
data_files = [] data_files = []
if os.name != 'nt': if os.name != 'nt':
if xdg_data_dirs is not None:
for index, size in enumerate(ICONS_SIZE):
data_file = (icons_path + size + '/apps', [ICONS_LIST[index]])
data_files.append(data_file)
else:
data_files = [(icons_path, ICONS_LIST)]
# Create all the hicolor icons
for index, size in enumerate(ICONS_SIZE):
data_file = (icons_path + size + '/apps', [ICONS_LIST[index]])
data_files.append(data_file)
if fallback_icons_path != '':
# Add the 48x48 icon as fallback in /usr/share/pixmaps
data_file = (fallback_icons_path, [ICONS_LIST[2]])
data_files.append(data_file)
params = { params = {
'data_files': data_files 'data_files': data_files

Loading…
Cancel
Save