2010-02-23 15:45:26 +00:00
|
|
|
#!/usr/bin/env python
|
2010-03-21 23:58:01 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# OpenLP - Open Source Lyrics Projection #
|
|
|
|
# --------------------------------------------------------------------------- #
|
2012-12-29 20:56:56 +00:00
|
|
|
# Copyright (c) 2008-2013 Raoul Snyman #
|
|
|
|
# Portions copyright (c) 2008-2013 Tim Bentley, Gerald Britton, Jonathan #
|
2012-06-22 14:14:53 +00:00
|
|
|
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
|
|
|
|
# Meinert Jordan, Armin Köhler, Edwin Lunando, Joshua Miller, Stevan Pettit, #
|
|
|
|
# Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, #
|
|
|
|
# Simon Scudder, Jeffrey Smith, Maikel Stuivenberg, Martin Thompson, Jon #
|
|
|
|
# Tibble, Dave Warnock, Frode Woldsund #
|
2010-03-21 23:58:01 +00:00
|
|
|
# --------------------------------------------------------------------------- #
|
|
|
|
# This program is free software; you can redistribute it and/or modify it #
|
|
|
|
# under the terms of the GNU General Public License as published by the Free #
|
|
|
|
# Software Foundation; version 2 of the License. #
|
|
|
|
# #
|
|
|
|
# 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, write to the Free Software Foundation, Inc., 59 #
|
|
|
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
|
|
|
###############################################################################
|
2010-02-23 15:45:26 +00:00
|
|
|
|
2010-02-14 21:20:13 +00:00
|
|
|
from setuptools import setup, find_packages
|
2012-07-08 19:46:40 +00:00
|
|
|
import re
|
2009-09-08 19:58:05 +00:00
|
|
|
|
2010-02-14 21:20:13 +00:00
|
|
|
VERSION_FILE = 'openlp/.version'
|
2012-07-09 17:56:02 +00:00
|
|
|
SPLIT_ALPHA_DIGITS = re.compile(r'(\d+|\D+)')
|
2009-09-08 19:58:05 +00:00
|
|
|
|
2012-07-09 17:56:02 +00:00
|
|
|
def try_int(s):
|
|
|
|
"""
|
|
|
|
Convert string s to an integer if possible. Fail silently and return
|
|
|
|
the string as-is if it isn't an integer.
|
|
|
|
|
|
|
|
``s``
|
|
|
|
The string to try to convert.
|
|
|
|
"""
|
|
|
|
try:
|
|
|
|
return int(s)
|
|
|
|
except Exception:
|
|
|
|
return s
|
2012-07-08 19:46:40 +00:00
|
|
|
|
2012-07-09 17:56:02 +00:00
|
|
|
def natural_sort_key(s):
|
|
|
|
"""
|
|
|
|
Return a tuple by which s is sorted.
|
2012-07-08 19:46:40 +00:00
|
|
|
|
2012-07-09 17:56:02 +00:00
|
|
|
``s``
|
|
|
|
A string value from the list we want to sort.
|
|
|
|
"""
|
|
|
|
return map(try_int, SPLIT_ALPHA_DIGITS.findall(s))
|
2012-07-08 19:46:40 +00:00
|
|
|
|
2012-07-09 17:56:02 +00:00
|
|
|
def natural_compare(a, b):
|
|
|
|
"""
|
|
|
|
Compare two strings naturally and return the result.
|
2012-07-08 19:46:40 +00:00
|
|
|
|
2012-07-09 17:56:02 +00:00
|
|
|
``a``
|
|
|
|
A string to compare.
|
2012-07-08 19:46:40 +00:00
|
|
|
|
2012-07-09 17:56:02 +00:00
|
|
|
``b``
|
|
|
|
A string to compare.
|
|
|
|
"""
|
|
|
|
return cmp(natural_sort_key(a), natural_sort_key(b))
|
2012-07-08 19:46:40 +00:00
|
|
|
|
2012-07-09 17:56:02 +00:00
|
|
|
def natural_sort(seq, compare=natural_compare):
|
|
|
|
"""
|
|
|
|
Returns a copy of seq, sorted by natural string sort.
|
|
|
|
"""
|
|
|
|
import copy
|
|
|
|
temp = copy.copy(seq)
|
|
|
|
temp.sort(compare)
|
|
|
|
return temp
|
2012-07-08 19:46:40 +00:00
|
|
|
|
2012-07-09 17:56:02 +00:00
|
|
|
try:
|
|
|
|
# Try to import Bazaar
|
2010-02-14 21:20:13 +00:00
|
|
|
from bzrlib.branch import Branch
|
|
|
|
b = Branch.open_containing('.')[0]
|
|
|
|
b.lock_read()
|
|
|
|
try:
|
2010-02-22 18:47:29 +00:00
|
|
|
# Get the branch's latest revision number.
|
2010-02-19 19:17:32 +00:00
|
|
|
revno = b.revno()
|
2010-02-22 18:47:29 +00:00
|
|
|
# Convert said revision number into a bzr revision id.
|
|
|
|
revision_id = b.dotted_revno_to_revision_id((revno,))
|
|
|
|
# Get a dict of tags, with the revision id as the key.
|
|
|
|
tags = b.tags.get_reverse_tag_dict()
|
|
|
|
# Check if the latest
|
|
|
|
if revision_id in tags:
|
|
|
|
version = u'%s' % tags[revision_id][0]
|
|
|
|
else:
|
2012-07-08 19:46:40 +00:00
|
|
|
version = '%s-bzr%s' % \
|
|
|
|
(natural_sort(b.tags.get_tag_dict().keys())[-1], revno)
|
2010-02-22 18:47:29 +00:00
|
|
|
ver_file = open(VERSION_FILE, u'w')
|
|
|
|
ver_file.write(version)
|
|
|
|
ver_file.close()
|
2010-02-14 21:20:13 +00:00
|
|
|
finally:
|
|
|
|
b.unlock()
|
|
|
|
except:
|
2010-02-23 15:45:06 +00:00
|
|
|
ver_file = open(VERSION_FILE, u'r')
|
2010-02-22 18:47:29 +00:00
|
|
|
version = ver_file.read().strip()
|
|
|
|
ver_file.close()
|
2009-08-27 14:02:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
setup(
|
2010-02-14 21:20:13 +00:00
|
|
|
name='OpenLP',
|
|
|
|
version=version,
|
|
|
|
description="Open source Church presentation and lyrics projection application.",
|
|
|
|
long_description="""\
|
|
|
|
OpenLP (previously openlp.org) is free church presentation software, or lyrics projection software, used to display slides of songs, Bible verses, videos, images, and even presentations (if PowerPoint is installed) for church worship using a computer and a data projector.""",
|
2011-03-19 07:20:20 +00:00
|
|
|
classifiers=[
|
|
|
|
'Development Status :: 4 - Beta',
|
|
|
|
'Environment :: MacOS X',
|
|
|
|
'Environment :: Win32 (MS Windows)',
|
|
|
|
'Environment :: X11 Applications',
|
|
|
|
'Environment :: X11 Applications :: Qt',
|
|
|
|
'Intended Audience :: End Users/Desktop',
|
|
|
|
'Intended Audience :: Religion',
|
|
|
|
'License :: OSI Approved :: GNU General Public License (GPL)',
|
|
|
|
'Natural Language :: Afrikaans',
|
|
|
|
'Natural Language :: Dutch',
|
|
|
|
'Natural Language :: English',
|
|
|
|
'Natural Language :: French',
|
|
|
|
'Natural Language :: German',
|
|
|
|
'Natural Language :: Hungarian',
|
|
|
|
'Natural Language :: Indonesian',
|
|
|
|
'Natural Language :: Japanese',
|
|
|
|
'Natural Language :: Norwegian',
|
|
|
|
'Natural Language :: Portuguese (Brazilian)',
|
|
|
|
'Natural Language :: Russian',
|
|
|
|
'Natural Language :: Swedish',
|
|
|
|
'Operating System :: MacOS :: MacOS X',
|
|
|
|
'Operating System :: Microsoft :: Windows',
|
|
|
|
'Operating System :: POSIX :: BSD :: FreeBSD',
|
|
|
|
'Operating System :: POSIX :: Linux',
|
|
|
|
'Programming Language :: Python',
|
|
|
|
'Programming Language :: Python :: 2',
|
|
|
|
'Topic :: Desktop Environment :: Gnome',
|
|
|
|
'Topic :: Desktop Environment :: K Desktop Environment (KDE)',
|
|
|
|
'Topic :: Multimedia',
|
|
|
|
'Topic :: Multimedia :: Graphics :: Presentation',
|
|
|
|
'Topic :: Multimedia :: Sound/Audio',
|
|
|
|
'Topic :: Multimedia :: Video',
|
|
|
|
'Topic :: Religion'
|
|
|
|
], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
|
2010-02-14 21:20:13 +00:00
|
|
|
keywords='open source church presentation lyrics projection song bible display project',
|
|
|
|
author='Raoul Snyman',
|
|
|
|
author_email='raoulsnyman@openlp.org',
|
|
|
|
url='http://openlp.org/',
|
|
|
|
license='GNU General Public License',
|
|
|
|
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
|
2012-03-25 06:26:12 +00:00
|
|
|
scripts=['openlp.pyw'],
|
2010-02-14 21:20:13 +00:00
|
|
|
include_package_data=True,
|
|
|
|
zip_safe=False,
|
|
|
|
install_requires=[
|
|
|
|
# -*- Extra requirements: -*-
|
|
|
|
],
|
|
|
|
entry_points="""
|
|
|
|
# -*- Entry points: -*-
|
|
|
|
"""
|
2011-02-24 05:47:38 +00:00
|
|
|
)
|