2010-03-21 23:58:01 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2013-07-18 19:28:35 +00:00
|
|
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
2010-03-21 23:58:01 +00:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# OpenLP - Open Source Lyrics Projection #
|
|
|
|
# --------------------------------------------------------------------------- #
|
2015-12-31 22:46:06 +00:00
|
|
|
# Copyright (c) 2008-2016 OpenLP Developers #
|
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
|
|
|
|
2012-07-08 19:46:40 +00:00
|
|
|
import re
|
2013-04-16 17:56:06 +00:00
|
|
|
from setuptools import setup, find_packages
|
|
|
|
from subprocess import Popen, PIPE
|
|
|
|
|
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
|
|
|
|
2013-04-16 17:56:06 +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.
|
|
|
|
|
2014-03-17 19:05:55 +00:00
|
|
|
:param s: The string to try to convert.
|
2012-07-09 17:56:02 +00:00
|
|
|
"""
|
|
|
|
try:
|
|
|
|
return int(s)
|
2014-10-09 21:03:04 +00:00
|
|
|
except (TypeError, ValueError):
|
2012-07-09 17:56:02 +00:00
|
|
|
return s
|
2012-07-08 19:46:40 +00:00
|
|
|
|
2013-04-16 17:56:06 +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
|
|
|
|
2014-03-17 19:05:55 +00:00
|
|
|
:param s: A string value from the list we want to sort.
|
2012-07-09 17:56:02 +00:00
|
|
|
"""
|
2013-08-31 18:17:38 +00:00
|
|
|
return list(map(try_int, SPLIT_ALPHA_DIGITS.findall(s)))
|
2012-07-08 19:46:40 +00:00
|
|
|
|
2013-04-16 17:56:06 +00:00
|
|
|
|
2014-10-09 21:03:04 +00:00
|
|
|
def natural_sort(seq):
|
2012-07-09 17:56:02 +00:00
|
|
|
"""
|
|
|
|
Returns a copy of seq, sorted by natural string sort.
|
2014-10-09 21:03:04 +00:00
|
|
|
|
|
|
|
:param seq: The sequence to sort.
|
|
|
|
:param compare: The comparison method to use
|
|
|
|
:return: The sorted sequence
|
2012-07-09 17:56:02 +00:00
|
|
|
"""
|
|
|
|
import copy
|
|
|
|
temp = copy.copy(seq)
|
2014-10-09 21:03:04 +00:00
|
|
|
temp.sort(key=natural_sort_key)
|
2012-07-09 17:56:02 +00:00
|
|
|
return temp
|
2012-07-08 19:46:40 +00:00
|
|
|
|
2014-10-09 21:03:04 +00:00
|
|
|
|
2013-06-06 06:40:10 +00:00
|
|
|
# NOTE: The following code is a duplicate of the code in openlp/core/utils/__init__.py. Any fix applied here should also
|
|
|
|
# be applied there.
|
2014-10-22 20:43:05 +00:00
|
|
|
ver_file = None
|
2012-07-09 17:56:02 +00:00
|
|
|
try:
|
2013-06-06 06:40:10 +00:00
|
|
|
# Get the revision of this tree.
|
2013-08-31 18:17:38 +00:00
|
|
|
bzr = Popen(('bzr', 'revno'), stdout=PIPE)
|
2013-06-06 06:40:10 +00:00
|
|
|
tree_revision, error = bzr.communicate()
|
2013-04-16 17:56:06 +00:00
|
|
|
code = bzr.wait()
|
|
|
|
if code != 0:
|
2013-08-31 18:17:38 +00:00
|
|
|
raise Exception('Error running bzr log')
|
2013-06-06 06:40:10 +00:00
|
|
|
|
|
|
|
# Get all tags.
|
2013-08-31 18:17:38 +00:00
|
|
|
bzr = Popen(('bzr', 'tags'), stdout=PIPE)
|
2013-04-16 17:56:06 +00:00
|
|
|
output, error = bzr.communicate()
|
|
|
|
code = bzr.wait()
|
|
|
|
if code != 0:
|
2013-08-31 18:17:38 +00:00
|
|
|
raise Exception('Error running bzr tags')
|
2013-06-06 06:40:10 +00:00
|
|
|
tags = output.splitlines()
|
|
|
|
if not tags:
|
2013-08-31 18:17:38 +00:00
|
|
|
tag_version = '0.0.0'
|
|
|
|
tag_revision = '0'
|
2013-06-06 06:40:10 +00:00
|
|
|
else:
|
|
|
|
# Remove any tag that has "?" as revision number. A "?" as revision number indicates, that this tag is from
|
|
|
|
# another series.
|
2013-08-31 18:17:38 +00:00
|
|
|
tags = [tag for tag in tags if tag.split()[-1].strip() != '?']
|
2013-06-06 06:40:10 +00:00
|
|
|
# Get the last tag and split it in a revision and tag name.
|
|
|
|
tag_version, tag_revision = tags[-1].split()
|
|
|
|
# If they are equal, then this tree is tarball with the source for the release. We do not want the revision number
|
|
|
|
# in the version string.
|
2014-07-02 19:34:28 +00:00
|
|
|
tree_revision = tree_revision.strip()
|
|
|
|
tag_revision = tag_revision.strip()
|
2013-06-06 06:40:10 +00:00
|
|
|
if tree_revision == tag_revision:
|
2014-07-01 21:10:26 +00:00
|
|
|
version_string = tag_version.decode('utf-8')
|
2013-06-06 06:40:10 +00:00
|
|
|
else:
|
2014-07-01 21:10:26 +00:00
|
|
|
version_string = '%s-bzr%s' % (tag_version.decode('utf-8'), tree_revision.decode('utf-8'))
|
2013-08-31 18:17:38 +00:00
|
|
|
ver_file = open(VERSION_FILE, 'w')
|
2013-06-06 06:40:10 +00:00
|
|
|
ver_file.write(version_string)
|
2010-02-14 21:20:13 +00:00
|
|
|
except:
|
2013-08-31 18:17:38 +00:00
|
|
|
ver_file = open(VERSION_FILE, 'r')
|
2013-06-06 06:40:10 +00:00
|
|
|
version_string = ver_file.read().strip()
|
|
|
|
finally:
|
2010-02-22 18:47:29 +00:00
|
|
|
ver_file.close()
|
2009-08-27 14:02:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
setup(
|
2010-02-14 21:20:13 +00:00
|
|
|
name='OpenLP',
|
2013-06-06 06:40:10 +00:00
|
|
|
version=version_string,
|
2010-02-14 21:20:13 +00:00
|
|
|
description="Open source Church presentation and lyrics projection application.",
|
|
|
|
long_description="""\
|
2014-04-02 18:51:21 +00:00
|
|
|
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',
|
2014-07-01 21:10:26 +00:00
|
|
|
'Programming Language :: Python :: 3',
|
2011-03-19 07:20:20 +00:00
|
|
|
'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'
|
2014-04-02 18:51:21 +00:00
|
|
|
], # 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']),
|
2013-02-03 16:40:39 +00:00
|
|
|
scripts=['openlp.py'],
|
2010-02-14 21:20:13 +00:00
|
|
|
include_package_data=True,
|
|
|
|
zip_safe=False,
|
|
|
|
install_requires=[
|
|
|
|
# -*- Extra requirements: -*-
|
2013-04-03 19:46:41 +00:00
|
|
|
'sqlalchemy',
|
|
|
|
'alembic'
|
2010-02-14 21:20:13 +00:00
|
|
|
],
|
|
|
|
entry_points="""
|
|
|
|
# -*- Entry points: -*-
|
|
|
|
"""
|
2011-02-24 05:47:38 +00:00
|
|
|
)
|