From 1c94f60d96a7cc8e679f214879542d1102a4ef61 Mon Sep 17 00:00:00 2001 From: Mathieu Comandon Date: Sat, 10 Nov 2012 00:01:55 +0100 Subject: [PATCH] Fixed setup.py script and removed dependency on distutils-extra --- MANIFEST.in | 10 ++++++ lutris.desktop | 3 +- lutris.desktop.in | 3 +- lutris/lutrisconfig.py | 63 ---------------------------------- lutris/settings.py | 4 ++- setup.py | 76 ++++++++++++++++++++++-------------------- 6 files changed, 55 insertions(+), 104 deletions(-) create mode 100644 MANIFEST.in delete mode 100644 lutris/lutrisconfig.py diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000000..c90c78d724 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,10 @@ +recursive-include lutris *.py +recursive-include data/media * +recursive-include data/ui * +include bin/lutris +include LICENSE +include AUTHORS +include MANIFEST.in +include README +graft debian +prune tests diff --git a/lutris.desktop b/lutris.desktop index 37a9fe1595..4fbc5d44b3 100644 --- a/lutris.desktop +++ b/lutris.desktop @@ -1,7 +1,6 @@ [Desktop Entry] -Version=0.2.1 +Version=0.2.7 Name=Lutris -GenericName=Lutris Gaming Platform Comment=Lutris application Categories=Game; Exec=lutris %U diff --git a/lutris.desktop.in b/lutris.desktop.in index e02097c5b9..ae4310d35b 100644 --- a/lutris.desktop.in +++ b/lutris.desktop.in @@ -4,6 +4,7 @@ Name=Lutris Comment=Lutris application Categories=Game; Exec=lutris -Icon=/usr/share/lutris/media/lutris.svg +Icon=lutris Terminal=false Type=Application +MimeType=application/x-lutris;x-scheme-handler/lutris; diff --git a/lutris/lutrisconfig.py b/lutris/lutrisconfig.py deleted file mode 100644 index a8464b9770..0000000000 --- a/lutris/lutrisconfig.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/python -# -*- coding:Utf-8 -*- -# -# Copyright (C) 2010 Mathieu Comandon -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -# where your project will head for your data (for instance, images and ui -# files) by default, this is ../data, relative your trunk layout -""" -Most likely generated by Quickly -""" -import os - -__lutris_data_directory__ = '/usr/share/lutris/' -__license__ = 'GPL-3' - - -class ProjectPathNotFound(Exception): - """Dummy exception for missing project path""" - print "can't find path " - - -def get_data_file(*path_segments): - """Get the full path to a data file. - - Returns the path to a file underneath the data directory (as defined by - `get_data_path`). Equivalent to os.path.join(get_data_path(), - *path_segments). - """ - return os.path.join(getdatapath(), *path_segments) - - -def getdatapath(): - """Retrieve lutris data path - - This path is by default /../data/ in trunk - and /usr/share/lutris in an installed version but this path - is specified at installation time. - """ - - # get pathname absolute or relative - if __lutris_data_directory__.startswith('/'): - pathname = __lutris_data_directory__ - else: - pathname = os.path.dirname(__file__) + '/' + __lutris_data_directory__ - - abs_data_path = os.path.abspath(pathname) - if os.path.exists(abs_data_path): - return abs_data_path - else: - raise ProjectPathNotFound diff --git a/lutris/settings.py b/lutris/settings.py index bba05db8c7..c3831fa854 100644 --- a/lutris/settings.py +++ b/lutris/settings.py @@ -36,7 +36,9 @@ def get_data_path(): """docstring for get_data_path""" launch_path = os.path.realpath(sys.path[0]) - if launch_path.startswith('/usr'): + if launch_path.startswith('/usr/local'): + data_path = '/usr/local/share/lutris' + elif launch_path.startswith('/usr'): data_path = '/usr/share/lutris' elif os.path.exists(os.path.normpath(os.path.join(sys.path[0], 'data'))): data_path = os.path.normpath(os.path.join(sys.path[0], 'data')) diff --git a/setup.py b/setup.py index caae99c3d4..609dc761d4 100644 --- a/setup.py +++ b/setup.py @@ -17,32 +17,23 @@ # import os -import lutris.constants - -try: - import DistUtilsExtra.auto -except ImportError: - import sys - print >> sys.stderr, 'To build lutris you need https://launchpad.net/python-distutils-extra' - sys.exit(1) - -assert DistUtilsExtra.auto.__version__ >= '2.10', 'needs DistUtilsExtra.auto >= 2.10' +import sys +from distutils.core import setup def update_data_path(prefix, oldvalue=None): - try: fin = file('lutris/lutrisconfig.py', 'r') fout = file(fin.name + '.new', 'w') for line in fin: - fields = line.split(' = ') # Separate variable from value + fields = line.split(' = ') # Separate variable from value if fields[0] == '__lutris_data_directory__': # update to prefix, store oldvalue if not oldvalue: oldvalue = fields[1] line = "%s = '%s'\n" % (fields[0], prefix) - else: # restore oldvalue + else: # restore oldvalue line = "%s = %s" % (fields[0], oldvalue) fout.write(line) @@ -50,13 +41,13 @@ def update_data_path(prefix, oldvalue=None): fout.close() fin.close() os.rename(fout.name, fin.name) - except (OSError, IOError), e: + except (OSError, IOError): print ("ERROR: Can't find lutris/lutrisconfig.py") sys.exit(1) return oldvalue -def update_desktop_file(datadir): +def update_desktop_file(datadir): try: fin = file('lutris.desktop.in', 'r') fout = file(fin.name + '.new', 'w') @@ -69,34 +60,45 @@ def update_desktop_file(datadir): fout.close() fin.close() os.rename(fout.name, fin.name) - except (OSError, IOError), e: + except (OSError, IOError): print ("ERROR: Can't find lutris.desktop.in") sys.exit(1) -class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto): - def run(self): - if self.root or self.home: - print "WARNING: You don't use a standard --prefix installation, take care that you eventually " \ - "need to update quickly/quicklyconfig.py file to adjust __quickly_data_directory__. You can " \ - "ignore this warning if you are packaging and uses --prefix." - previous_value = update_data_path(self.prefix + '/share/lutris/') - update_desktop_file(self.prefix + '/share/lutris/') - DistUtilsExtra.auto.install_auto.run(self) - update_data_path(self.prefix, previous_value) +data_files = [] +for directory, _, filenames in os.walk(u'data'): + dest = directory[5:] + if filenames: + files = [] + for filename in filenames: + filename = os.path.join(directory, filename) + files.append(filename) + data_files.append((os.path.join('share/lutris', dest), files)) +data_files.append(('share/icons', ['data/media/lutris.svg'])) +data_files.append(('share/applications', ['lutris.desktop'])) -DistUtilsExtra.auto.setup( +setup( name='lutris', - version=lutris.constants.version, + version='0.2.7', license='GPL-3', author='Mathieu Comandon', - author_email='strycore@gmail.com', + author_email='strider@strycore.com', + packages=['lutris', 'lutris.gui', 'lutris.util', 'lutris.runners'], + scripts=['bin/lutris'], + data_files=data_files, + #install_requires=['PyYAML'], + url='http://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 to make -gaming on Linux as easy as possible by taking care of installing -and setting up the game for the user. The only thing you have to -do is play the game. It aims to support every game that is playable -on Linux.""", - url='https://launchpad.net/lutris', - cmdclass={'install': InstallAndUpdateDataDirectory} - ) + long_description="""Lutris is a gaming platform for GNU/Linux. It's goal is + to make gaming on Linux as easy as possible by taking care of installing + and setting up the game for the user. The only thing you have to do is play + the game. It aims to support every game that is playable on Linux.""", + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: GPLv3', + 'Programming Language :: Python', + 'Operating System :: Linux', + 'Topic :: Games' + ], +)