mirror of
https://github.com/lutris/lutris
synced 2024-10-02 22:14:23 +00:00
Remove dependency on pyxdg
This commit is contained in:
parent
e77cff0d54
commit
5718e1a7ed
1
INSTALL
1
INSTALL
|
@ -8,7 +8,6 @@ Lutris should work on any fairly recent GNU/Linux system, the following
|
|||
dependencies are required:
|
||||
|
||||
* python == 2.7
|
||||
* python-xdg
|
||||
* python-yaml
|
||||
* PyGobject
|
||||
* libsoup-gnome
|
||||
|
|
|
@ -8,7 +8,6 @@ Lutris should work on any Gnome system, the following depencies should be
|
|||
installed:
|
||||
|
||||
* python == 2.7
|
||||
* python-xdg
|
||||
* python-yaml
|
||||
* PyGobject
|
||||
* libsoup-gnome
|
||||
|
|
5
debian/control
vendored
5
debian/control
vendored
|
@ -4,8 +4,7 @@ Priority: optional
|
|||
Build-Depends: cdbs (>= 0.4.43),
|
||||
debhelper (>= 6),
|
||||
python,
|
||||
python-support (>= 0.6.4),
|
||||
python-xdg
|
||||
python-support (>= 0.6.4)
|
||||
Maintainer: Mathieu Comandon <strider@strycore.com>
|
||||
Standards-Version: 3.9.5
|
||||
Vcs-Git: https://github.com/lutris/lutris
|
||||
|
@ -15,7 +14,7 @@ Package: lutris
|
|||
Architecture: all
|
||||
Depends: ${misc:Depends},
|
||||
${python:Depends},
|
||||
python-yaml, gir1.2-gtk-3.0, python-xdg, gvfs-backends, glib-networking
|
||||
python-yaml, gir1.2-gtk-3.0, gvfs-backends, glib-networking
|
||||
Description: Install and play any video game easily
|
||||
Lutris is a gaming platform for GNU/Linux. Its goal is to make
|
||||
gaming on Linux as easy as possible by taking care of installing
|
||||
|
|
12
lutris.spec
12
lutris.spec
|
@ -13,23 +13,23 @@ BuildArch: noarch
|
|||
|
||||
%if 0%{?fedora_version}
|
||||
|
||||
BuildRequires: python-devel, pyxdg
|
||||
BuildRequires: python-devel
|
||||
|
||||
Requires: pygobject3, pyxdg, PyYAML, gvfs, glib-networking
|
||||
Requires: pygobject3, PyYAML, gvfs, glib-networking
|
||||
|
||||
%endif
|
||||
%if 0%{?rhel_version} || 0%{?centos_version}
|
||||
|
||||
BuildRequires: python-devel, python3-xdg
|
||||
BuildRequires: python-devel
|
||||
|
||||
Requires: pygobject3, python3-xdg, PyYAML, gvfs, glib-networking
|
||||
Requires: pygobject3, PyYAML, gvfs, glib-networking
|
||||
|
||||
%endif
|
||||
%if 0%{?suse_version}
|
||||
|
||||
BuildRequires: python-devel, python-xdg
|
||||
BuildRequires: python-devel
|
||||
|
||||
Requires: python-gobject, python-gtk, python-xdg, python-PyYAML, gvfs-backends, glib-networking
|
||||
Requires: python-gobject, python-gtk, python-PyYAML, gvfs-backends, glib-networking
|
||||
|
||||
#!BuildIgnore: rpmlint-mini
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ from lutris.sync import Sync
|
|||
|
||||
from lutris.util import runtime
|
||||
from lutris.util import resources
|
||||
from lutris.util import system
|
||||
from lutris.util.log import logger
|
||||
from lutris.util.jobs import async_call
|
||||
from lutris.util.strings import slugify
|
||||
|
@ -335,7 +334,7 @@ class LutrisWindow(object):
|
|||
connection_label.set_text(connection_status)
|
||||
|
||||
def on_register_account(self, *args):
|
||||
system.xdg_open("http://lutris.net/user/register")
|
||||
Gtk.show_uri(None, "http://lutris.net/user/register", Gdk.CURRENT_TIME)
|
||||
|
||||
def on_synchronize_manually(self, *args):
|
||||
"""Callback when Synchronize Library is activated."""
|
||||
|
@ -503,7 +502,7 @@ class LutrisWindow(object):
|
|||
game = Game(self.view.selected_game)
|
||||
path = game.get_browse_dir()
|
||||
if path and os.path.exists(path):
|
||||
system.xdg_open(path)
|
||||
Gtk.show_uri(None, 'file://' + path, Gdk.CURRENT_TIME)
|
||||
else:
|
||||
dialogs.NoticeDialog(
|
||||
"Can't open %s \nThe folder doesn't exist." % path
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
# -*- coding:Utf-8 -*-
|
||||
from gi.repository import Gtk, GObject
|
||||
from gi.repository import Gtk, GObject, Gdk
|
||||
|
||||
import lutris.runners
|
||||
from lutris import settings
|
||||
from lutris.gui.widgets import get_runner_icon
|
||||
from lutris.util import system
|
||||
from lutris.runners import import_runner
|
||||
from lutris.gui.config_dialogs import RunnerConfigDialog
|
||||
from lutris.gui.runnerinstalldialog import RunnerInstallDialog
|
||||
|
@ -152,7 +151,7 @@ class RunnersDialog(Gtk.Window):
|
|||
runner, runner_label)
|
||||
|
||||
def on_runner_open_clicked(self, widget):
|
||||
system.xdg_open(settings.RUNNER_DIR)
|
||||
Gtk.show_uri(None, 'file://' + settings.RUNNER_DIR, Gdk.CURRENT_TIME)
|
||||
|
||||
def set_install_state(self, widget, runner, runner_label):
|
||||
if runner.is_installed():
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding:Utf-8 -*-
|
||||
"""Settings module"""
|
||||
import os
|
||||
from xdg import BaseDirectory
|
||||
from gi.repository import GLib
|
||||
from lutris.util.settings import SettingsIO
|
||||
|
||||
PROJECT = "Lutris"
|
||||
|
@ -12,18 +12,18 @@ AUTHORS = ["Mathieu Comandon <strycore@gmail.com>",
|
|||
ARTISTS = ["Ludovic Soulié <contact@ludal.net>"]
|
||||
|
||||
# Paths
|
||||
CONFIG_DIR = os.path.join(BaseDirectory.xdg_config_home, 'lutris')
|
||||
CONFIG_DIR = os.path.join(GLib.get_user_config_dir(), 'lutris')
|
||||
CONFIG_FILE = os.path.join(CONFIG_DIR, "lutris.conf")
|
||||
DATA_DIR = os.path.join(BaseDirectory.xdg_data_home, 'lutris')
|
||||
DATA_DIR = os.path.join(GLib.get_user_data_dir(), 'lutris')
|
||||
RUNNER_DIR = os.path.join(DATA_DIR, "runners")
|
||||
RUNTIME_DIR = os.path.join(DATA_DIR, "runtime")
|
||||
CACHE_DIR = os.path.join(BaseDirectory.xdg_cache_home, 'lutris')
|
||||
CACHE_DIR = os.path.join(GLib.get_user_cache_dir(), 'lutris')
|
||||
GAME_CONFIG_DIR = os.path.join(CONFIG_DIR, 'games')
|
||||
|
||||
TMP_PATH = os.path.join(CACHE_DIR, 'tmp')
|
||||
BANNER_PATH = os.path.join(DATA_DIR, 'banners')
|
||||
ICON_PATH = os.path.join(BaseDirectory.xdg_data_home,
|
||||
'icons/hicolor/32x32/apps')
|
||||
ICON_PATH = os.path.join(GLib.get_user_data_dir(),
|
||||
'icons', 'hicolor', '32x32', 'apps')
|
||||
|
||||
sio = SettingsIO(CONFIG_FILE)
|
||||
PGA_DB = sio.read_setting('pga_path') or os.path.join(DATA_DIR, 'pga.db')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
""" xdg desktop file creator """
|
||||
""" desktop file creator """
|
||||
import os
|
||||
import stat
|
||||
import shutil
|
||||
|
@ -6,15 +6,16 @@ import subprocess
|
|||
|
||||
from textwrap import dedent
|
||||
from xdg import BaseDirectory
|
||||
from gi.repository import GLib
|
||||
|
||||
from lutris.settings import CACHE_DIR
|
||||
|
||||
|
||||
def create_launcher(game_slug, game_name, desktop=False, menu=False):
|
||||
"""Create .desktop file."""
|
||||
desktop_dir = subprocess.Popen(['xdg-user-dir', 'DESKTOP'],
|
||||
stdout=subprocess.PIPE).communicate()[0]
|
||||
desktop_dir = desktop_dir.strip()
|
||||
desktop_dir = (
|
||||
GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DESKTOP)
|
||||
)
|
||||
launcher_content = dedent(
|
||||
"""
|
||||
[Desktop Entry]
|
||||
|
@ -37,7 +38,7 @@ def create_launcher(game_slug, game_name, desktop=False, menu=False):
|
|||
shutil.copy(tmp_launcher_path,
|
||||
os.path.join(desktop_dir, launcher_filename))
|
||||
if menu:
|
||||
menu_path = os.path.join(BaseDirectory.xdg_data_home, 'applications')
|
||||
menu_path = os.path.join(GLib.get_user_data_dir(), 'applications')
|
||||
shutil.copy(tmp_launcher_path,
|
||||
os.path.join(menu_path, launcher_filename))
|
||||
os.remove(tmp_launcher_path)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
"""Utility module for creating an application wide logger."""
|
||||
import logging
|
||||
import logging.handlers
|
||||
import xdg.BaseDirectory
|
||||
from gi.repository import GLib
|
||||
|
||||
from os import makedirs
|
||||
from os.path import join, isdir, realpath
|
||||
|
||||
CACHE_DIR = realpath(join(xdg.BaseDirectory.xdg_cache_home, "lutris"))
|
||||
CACHE_DIR = realpath(join(GLib.get_user_cache_dir(), "lutris"))
|
||||
if not isdir(CACHE_DIR):
|
||||
makedirs(CACHE_DIR)
|
||||
|
||||
|
|
|
@ -177,10 +177,6 @@ def fix_path_case(path):
|
|||
return current_path
|
||||
|
||||
|
||||
def xdg_open(path):
|
||||
subprocess.Popen(['xdg-open', path], close_fds=True)
|
||||
|
||||
|
||||
def get_pids_using_file(path):
|
||||
"""Return a list of pids using file `path`"""
|
||||
if not os.path.exists(path):
|
||||
|
|
|
@ -1,57 +1,32 @@
|
|||
"""Get games available from the XDG menu"""
|
||||
import xdg.Menu
|
||||
import locale
|
||||
|
||||
import subprocess
|
||||
from gi.repository import Gio
|
||||
|
||||
IGNORED_ENTRIES = ["lutris", "mame", "dosbox", "steam"]
|
||||
|
||||
locale._strxfrm = locale.strxfrm
|
||||
|
||||
|
||||
def strxfrm(s):
|
||||
"""Monkey patch to address an encoding bug in pyxdg (fixed in current
|
||||
trunk)"""
|
||||
return locale._strxfrm(s.encode('utf-8'))
|
||||
locale.strxfrm = strxfrm
|
||||
|
||||
|
||||
def get_main_menu():
|
||||
return xdg.Menu.parse()
|
||||
|
||||
|
||||
def get_game_entries(menu):
|
||||
menu_entries = [entry for entry in menu.getEntries()]
|
||||
game_entries = []
|
||||
for entry in menu_entries:
|
||||
if hasattr(entry, 'Categories') and 'Game' in entry.Categories:
|
||||
game_entries.append(entry)
|
||||
elif hasattr(entry, 'getEntries') and entry.getName() == 'Games':
|
||||
game_entries += get_game_entries(entry)
|
||||
return game_entries
|
||||
IGNORED_ENTRIES = ("lutris", "mame", "dosbox", "steam", "playonlinux")
|
||||
|
||||
|
||||
def get_xdg_games():
|
||||
"""Return list of games stored in the XDG menu."""
|
||||
xdg_games = []
|
||||
for game in get_game_entries(get_main_menu()):
|
||||
|
||||
if not isinstance(game, xdg.Menu.MenuEntry):
|
||||
apps = Gio.AppInfo.get_all()
|
||||
for app in apps:
|
||||
if app.get_name().lower() in IGNORED_ENTRIES:
|
||||
continue
|
||||
entry_name = str(game)[:-(len(".desktop"))]
|
||||
if entry_name in IGNORED_ENTRIES:
|
||||
categories = app.get_categories()
|
||||
if not categories or not 'Game' in categories:
|
||||
continue
|
||||
desktop_entry = game.DesktopEntry
|
||||
game_name = unicode(desktop_entry)
|
||||
exe_and_args = desktop_entry.getExec().split(' ', 2)
|
||||
|
||||
exe_and_args = app.get_string('Exec').split(' ', 2)
|
||||
if len(exe_and_args) == 1:
|
||||
exe = exe_and_args[0]
|
||||
args = ''
|
||||
exe, args = exe_and_args[0], ''
|
||||
else:
|
||||
exe, args = exe_and_args
|
||||
if not exe.startswith('/'):
|
||||
exe = subprocess.Popen("which '%s'" % exe, stdout=subprocess.PIPE,
|
||||
shell=True).communicate()[0].strip('\n')
|
||||
xdg_games.append((game_name, exe, args))
|
||||
xdg_games.append((app.get_display_name(), exe, args))
|
||||
return xdg_games
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
2
setup.py
2
setup.py
|
@ -87,7 +87,7 @@ setup(
|
|||
scripts=['bin/lutris'],
|
||||
data_files=data_files,
|
||||
# FIXME: find a way to install dependencies
|
||||
# install_requires=['PyYAML', 'pyxdg', 'PyGObject'],
|
||||
# install_requires=['PyYAML', 'PyGObject'],
|
||||
url='https://lutris.net',
|
||||
description='Install and play any video game on Linux',
|
||||
long_description="""Lutris is a gaming platform for GNU/Linux. It's goal is
|
||||
|
|
Loading…
Reference in a new issue