This fixes setuptools' dependencies according to scripts/check_dependencies.py.

The minimum Python version is set to 3.6 because this was agreed to on the mailing list.
Some packages which are optional in the source are declared as optional (uno, pyenchant, pyodbc).

To overcome a module conflict, openlp.py is replaced with run_openlp.py which setuptools installs as /usr/bin/openlp (or openlp.exe on Windows).

Additionally, pyxdg is replaced with appdirs (see License violations issue).

bzr-revno: 2836
This commit is contained in:
Bastian Germann 2018-10-24 20:22:28 +02:00 committed by Tomas Groth
commit cd5939eb3b
10 changed files with 189 additions and 71 deletions

View File

@ -288,7 +288,7 @@ def parse_options(args=None):
:return: a tuple of parsed options of type optparse.Value and a list of remaining argsZ
"""
# Set up command line options.
parser = argparse.ArgumentParser(prog='openlp.py')
parser = argparse.ArgumentParser(prog='openlp')
parser.add_argument('-e', '--no-error-form', dest='no_error_form', action='store_true',
help='Disable the error notification form.')
parser.add_argument('-l', '--log-level', dest='loglevel', default='warning', metavar='LEVEL',

View File

@ -26,18 +26,13 @@ import logging
import os
import sys
import appdirs
import openlp
from openlp.core.common import get_frozen_path, is_win, is_macosx
from openlp.core.common.path import Path, create_paths
from openlp.core.common.settings import Settings
if not is_win() and not is_macosx():
try:
from xdg import BaseDirectory
XDG_BASE_AVAILABLE = True
except ImportError:
XDG_BASE_AVAILABLE = False
log = logging.getLogger(__name__)
FROZEN_APP_PATH = Path(sys.argv[0]).parent
@ -143,8 +138,10 @@ def _get_os_dir_path(dir_type):
elif dir_type == AppLocation.LanguageDir:
return Path(openlp.__file__).parent
return openlp_folder_path
elif is_macosx():
openlp_folder_path = Path(os.getenv('HOME'), 'Library', 'Application Support', 'openlp')
dirs = appdirs.AppDirs('openlp', multipath=True)
if is_macosx():
openlp_folder_path = Path(dirs.user_data_dir)
if dir_type == AppLocation.DataDir:
return openlp_folder_path / 'Data'
elif dir_type == AppLocation.LanguageDir:
@ -152,15 +149,15 @@ def _get_os_dir_path(dir_type):
return openlp_folder_path
else:
if dir_type == AppLocation.LanguageDir:
directory = Path('/usr', 'local', 'share', 'openlp')
site_dirs = dirs.site_data_dir.split(os.pathsep)
directory = Path(site_dirs[0])
if directory.exists():
return directory
return Path('/usr', 'share', 'openlp')
if XDG_BASE_AVAILABLE:
if dir_type == AppLocation.DataDir:
return Path(BaseDirectory.xdg_data_home, 'openlp')
elif dir_type == AppLocation.CacheDir:
return Path(BaseDirectory.xdg_cache_home, 'openlp')
return Path(site_dirs[1])
if dir_type == AppLocation.DataDir:
return Path(dirs.user_data_dir)
elif dir_type == AppLocation.CacheDir:
return Path(dirs.user_cache_dir)
if dir_type == AppLocation.DataDir:
return Path(os.getenv('HOME'), '.openlp', 'data')
return Path(os.getenv('HOME'), '.openlp')

View File

@ -57,8 +57,7 @@ class Registry(object):
registry.functions_list = {}
registry.working_flags = {}
# Allow the tests to remove Registry entries but not the live system
registry.running_under_test = 'nose' in sys.argv[0]
registry.running_under_test = 'pytest' in sys.argv[0]
registry.running_under_test = 'nose' in sys.argv[0] or 'pytest' in sys.argv[0]
registry.initialising = True
return registry

View File

@ -112,8 +112,8 @@ class UiAboutDialog(object):
'Andreas "googol" Preikschat', 'Ken "alisonken1" Roberts', 'Raoul "superfly" Snyman',
'Jonathan "springermac" Springer', 'Philip "Phill" Ridout']
contributors = ['Stuart "sibecker" Becker', 'Gerald "jerryb" Britton', 'Jonathan "gushie" Corwin',
'Samuel "MrGamgee" Findlay', 'Michael "cocooncrash" Gorven', 'Scott "sguerrieri" Guerrieri',
'Simon Hanna', 'Chris Hill',
'Samuel "MrGamgee" Findlay', 'Bastian Germann', 'Michael "cocooncrash" Gorven',
'Scott "sguerrieri" Guerrieri', 'Simon Hanna', 'Chris Hill',
'Matthias "matthub" Hub', 'Meinert "m2j" Jordan', 'Ian Knightly'
'Armin "orangeshirt" K\xf6hler',
'Rafael "rafaellerm" Lerm', 'Gabriel loo', 'Erik "luen" Lundin', 'Edwin "edwinlunando" Lunando',

View File

@ -0,0 +1,94 @@
Copyright Dave Gandy 2016. All rights reserved
with Reserved Font Name FontAwesome
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

View File

@ -42,7 +42,7 @@ def set_up_fault_handling():
faulthandler.enable((AppLocation.get_directory(AppLocation.CacheDir) / 'error.log').open('wb'))
if __name__ == '__main__':
def start():
"""
Instantiate and run the application.
"""
@ -58,3 +58,7 @@ if __name__ == '__main__':
if is_macosx():
sys.argv = [x for x in sys.argv if not x.startswith('-psn')]
main()
if __name__ == '__main__':
start()

View File

@ -11,11 +11,8 @@ environment:
install:
# Install dependencies from pypi
- "%PYTHON%\\python.exe -m pip install sqlalchemy alembic chardet beautifulsoup4 Mako nose mock pyodbc==4.0.8 psycopg2 pypiwin32==219 pyenchant websockets asyncio waitress six webob requests QtAwesome"
# Install mysql dependency
- "%PYTHON%\\python.exe -m pip install http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip#md5=3df394d89300db95163f17c843ef49df"
# Download and install lxml and pyicu (originally from http://www.lfd.uci.edu/~gohlke/pythonlibs/)
- "%PYTHON%\\python.exe -m pip install https://get.openlp.org/win-sdk/lxml-3.6.4-cp34-cp34m-win32.whl"
- "%PYTHON%\\python.exe -m pip install sqlalchemy alembic appdirs chardet beautifulsoup4 lxml Mako mysql-connector-python nose mock pyodbc==4.0.8 psycopg2 pypiwin32==219 pyenchant pymediainfo websockets asyncio waitress six webob requests QtAwesome"
# Download and install pyicu (originally from http://www.lfd.uci.edu/~gohlke/pythonlibs/)
- "%PYTHON%\\python.exe -m pip install https://get.openlp.org/win-sdk/PyICU-1.9.5-cp34-cp34m-win32.whl"
# Download and install PyQt5
- appveyor DownloadFile http://downloads.sourceforge.net/project/pyqt/PyQt5/PyQt-5.5.1/PyQt5-5.5.1-gpl-Py3.4-Qt5.5.1-x32.exe

View File

@ -33,24 +33,18 @@ import os
import sys
from distutils.version import LooseVersion
# If we try to import uno before nose this will create a warning. Just try to import nose first to suppress the warning.
try:
import nose
except ImportError:
nose = None
IS_WIN = sys.platform.startswith('win')
IS_LIN = sys.platform.startswith('lin')
IS_MAC = sys.platform.startswith('dar')
VERS = {
'Python': '3.4',
'Python': '3.6',
'PyQt5': '5.0',
'Qt5': '5.0',
'pymediainfo': '2.2',
'sqlalchemy': '0.5',
# pyenchant 1.6 required on Windows
'enchant': '1.6' if IS_WIN else '1.3'
'enchant': '1.6'
}
# pywin32
@ -58,7 +52,6 @@ WIN32_MODULES = [
'win32com',
'win32ui',
'pywintypes',
'pyodbc',
'icu',
]
@ -84,19 +77,16 @@ MODULES = [
'PyQt5.QtTest',
'PyQt5.QtWebKit',
'PyQt5.QtMultimedia',
'pymediainfo',
'appdirs',
'sqlalchemy',
'alembic',
'sqlite3',
'lxml',
'chardet',
'enchant',
'bs4',
'mako',
'uno',
'websockets',
'asyncio',
'waitress',
'six',
'webob',
'requests',
'qtawesome'
@ -104,12 +94,17 @@ MODULES = [
OPTIONAL_MODULES = [
('mysql.connector', '(MySQL support)', True),
('psycopg2', '(PostgreSQL support)', True),
('nose', '(testing framework)', True),
('mock', '(testing module)', sys.version_info[1] < 3),
('jenkins', '(access jenkins api - package name: jenkins-webapi)', True),
('pysword', '(import SWORD bibles)', True),
('mysql.connector', '(MySQL support)'),
('pyodbc', '(ODBC support)'),
('psycopg2', '(PostgreSQL support)'),
('enchant', '(spell checker)'),
('pysword', '(import SWORD bibles)'),
('uno', '(LibreOffice/OpenOffice support)'),
# development/testing modules
('jenkins', '(access jenkins api)'),
('launchpadlib', '(launchpad script support)'),
('nose2', '(testing framework)'),
('pylint', '(linter)')
]
w = sys.stdout.write
@ -238,8 +233,7 @@ def main():
check_module(m)
print('Checking for optional modules...')
for m in OPTIONAL_MODULES:
if m[2]:
check_module(m[0], text=m[1])
check_module(m[0], text=m[1])
if IS_WIN:
print('Checking for Windows specific modules...')
for m in WIN32_MODULES:

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
@ -21,6 +22,7 @@
###############################################################################
import re
import sys
from setuptools import setup, find_packages
from subprocess import Popen, PIPE
@ -109,6 +111,34 @@ except Exception:
finally:
ver_file.close()
requires = [
'alembic',
'appdirs',
'beautifulsoup4',
'chardet',
'lxml',
'Mako',
'pymediainfo >= 2.2',
'PyQt5',
'QtAwesome',
'requests',
'SQLAlchemy >= 0.5',
'waitress',
'WebOb',
'websockets'
]
if sys.platform.startswith('win'):
requires.extend([
'PyICU',
'pywin32'
])
elif sys.platform.startswith('darwin'):
requires.extend([
'pyobjc',
'pyobjc-framework-Cocoa'
])
elif sys.platform.startswith('linux'):
requires.append('dbus-python')
setup(
name='OpenLP',
@ -156,18 +186,25 @@ using a computer and a data projector.""",
keywords='open source church presentation lyrics projection song bible display project',
author='Raoul Snyman',
author_email='raoulsnyman@openlp.org',
url='http://openlp.org/',
url='https://openlp.org/',
license='GNU General Public License',
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
scripts=['openlp.py'],
packages=find_packages(exclude=['ez_setup', 'tests']),
py_modules=['run_openlp'],
include_package_data=True,
zip_safe=False,
install_requires=[
# -*- Extra requirements: -*-
'sqlalchemy',
'alembic'
],
entry_points="""
# -*- Entry points: -*-
"""
python_requires='>=3.6',
install_requires=requires,
extras_require={
'mysql': ['mysql-connector-python'],
'odbc': ['pyodbc'],
'postgresql': ['psycopg2'],
'spellcheck': ['pyenchant >= 1.6'],
'sword-bibles': ['pysword'],
# Required for scripts/*.py:
'jenkins': ['python-jenkins'],
'launchpad': ['launchpadlib']
},
tests_require=['nose2', 'PyICU', 'pylint', 'pyodbc', 'pysword'],
test_suite='nose2.collector.collector',
entry_points={'gui_scripts': ['openlp = run_openlp:start']}
)

View File

@ -8,10 +8,10 @@ Prerequisites
In order to run the unit tests, you will need the following Python packages/libraries installed:
- Mock
- Nose
- pytest
- pylint3
On Ubuntu you can simple install the python-mock and python-nose packages. Most other distributions will also have these
On Ubuntu you can simple install the python3-pytest and pylint3 packages. Most other distributions will also have these
packages. On Windows and Mac OS X you will need to use ``pip`` or ``easy_install`` to install these packages.
Running the Tests
@ -19,16 +19,12 @@ Running the Tests
To run the tests, navigate to the root directory of the OpenLP project, and then run the following command::
nosetests -v tests
pytest -v tests
Or, to run only the functional tests, run the following command::
nosetests -v tests/functional
pytest -v tests/functional
Or, to run only a particular test suite within a file, run the following command::
nosetests -v tests/functional/test_applocation.py
Finally, to only run a particular test, run the following command::
nosetests -v tests/functional/test_applocation.py:TestAppLocation.get_frozen_path_test
pytest -v tests/functional/openlp_core/test_app.py