Skip to content

Commit

Permalink
Fixed setup.py script and removed dependency on distutils-extra
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu Comandon committed Nov 9, 2012
1 parent 904ff84 commit 1c94f60
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 104 deletions.
10 changes: 10 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions lutris.desktop
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion lutris.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -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;
63 changes: 0 additions & 63 deletions lutris/lutrisconfig.py

This file was deleted.

4 changes: 3 additions & 1 deletion lutris/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
76 changes: 39 additions & 37 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,37 @@
#

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)

fout.flush()
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')
Expand All @@ -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='[email protected]',
author_email='[email protected]',
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'
],
)

0 comments on commit 1c94f60

Please sign in to comment.