1
0
mirror of https://github.com/lutris/lutris synced 2024-07-03 07:28:41 +00:00

Fixed setup.py script and removed dependency on distutils-extra

This commit is contained in:
Mathieu Comandon 2012-11-10 00:01:55 +01:00
parent 904ff84832
commit 1c94f60d96
6 changed files with 55 additions and 104 deletions

10
MANIFEST.in Normal file
View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -1,63 +0,0 @@
#!/usr/bin/python
# -*- coding:Utf-8 -*-
#
# Copyright (C) 2010 Mathieu Comandon <strider@strycore.com>
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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 <lutris_lib_path>/../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

View File

@ -36,7 +36,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
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'))

View File

@ -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'
],
)