From 39d5f332b2f371ae30a7f66de5533ab74d9d12a5 Mon Sep 17 00:00:00 2001 From: Jiri Kuncar Date: Thu, 15 Sep 2016 11:54:32 +0200 Subject: [PATCH] global: package compatibility improvements Signed-off-by: Jiri Kuncar --- .tx/config | 50 ------------------------------------- MANIFEST.in | 3 --- babel.ini | 40 ----------------------------- docs/conf.py | 6 +++-- examples/app.py | 2 -- invenio_indexer/__init__.py | 5 +--- invenio_indexer/cli.py | 2 +- setup.cfg | 18 ------------- setup.py | 10 ++------ tests/conftest.py | 3 +-- tests/test_utils.py | 2 +- 11 files changed, 10 insertions(+), 131 deletions(-) delete mode 100644 .tx/config delete mode 100644 babel.ini diff --git a/.tx/config b/.tx/config deleted file mode 100644 index b66c6d1..0000000 --- a/.tx/config +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# -# This file is part of Invenio. -# Copyright (C) 2016 CERN. -# -# Invenio 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; either version 2 of the -# License, or (at your option) any later version. -# -# Invenio 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 Invenio; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307, USA. -# -# In applying this license, CERN does not -# waive the privileges and immunities granted to it by virtue of its status -# as an Intergovernmental Organization or submit itself to any jurisdiction. - - -# TODO: Transifex integration -# -# 1) Create message catalog: -# $ python setup.py extract_messages -# $ python setup.py init_catalog -l -# $ python setup.py compile_catalog -# 2) Ensure project has been created on Transifex under the inveniosoftware -# organisation. -# 3) Install the transifex-client -# $ pip install transifex-client -# 4) Push source (.pot) and translations (.po) to Transifex -# $ tx push -s -t -# 5) Pull translations for a single language from Transifex -# $ tx pull -l -# 6) Pull translations for all languages from Transifex -# $ tx pull -a - -[main] -host = https://www.transifex.com - -[invenio-1.invenio-indexer-messages] -file_filter = invenio_indexer/translations//LC_MESSAGES/messages.po -source_file = invenio_indexer/translations/messages.pot -source_lang = en -type = PO diff --git a/MANIFEST.in b/MANIFEST.in index dbf9c04..805f755 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -27,8 +27,6 @@ include *.sh include *.txt include .dockerignore include .editorconfig -include .tx/config -include babel.ini include LICENSE include pytest.ini recursive-include docs *.bat @@ -38,7 +36,6 @@ recursive-include docs Makefile recursive-include examples *.json recursive-include examples *.py recursive-include examples *.sh -recursive-include invenio_indexer *.po *.pot *.mo recursive-include invenio_indexer *.py recursive-include tests *.json recursive-include tests *.py diff --git a/babel.ini b/babel.ini deleted file mode 100644 index 97baedf..0000000 --- a/babel.ini +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- -# -# This file is part of Invenio. -# Copyright (C) 2016 CERN. -# -# Invenio 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; either version 2 of the -# License, or (at your option) any later version. -# -# Invenio 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 Invenio; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307, USA. -# -# In applying this license, CERN does not -# waive the privileges and immunities granted to it by virtue of its status -# as an Intergovernmental Organization or submit itself to any jurisdiction. - -# Extraction from Python source files - -[python: **.py] -encoding = utf-8 - -# Extraction from Jinja2 templates - -[jinja2: **/templates/**.html] -encoding = utf-8 -extensions = jinja2.ext.autoescape, jinja2.ext.with_ - -# Extraction from JavaScript files - -[javascript: **.js] -encoding = utf-8 -extract_messages = $._, jQuery._ diff --git a/docs/conf.py b/docs/conf.py index 6a5e379..9cfb69c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -328,7 +328,9 @@ # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'https://docs.python.org/': None} - +intersphinx_mapping = { + 'python': ('https://docs.python.org/', None), + 'kombu': ('http://docs.celeryproject.org/projects/kombu/en/latest/', None), +} # Autodoc configuraton. autoclass_content = 'both' diff --git a/examples/app.py b/examples/app.py index 2d0325f..3682445 100644 --- a/examples/app.py +++ b/examples/app.py @@ -48,7 +48,6 @@ from flask import Flask from flask_celeryext import FlaskCeleryExt -from flask_cli import FlaskCLI from invenio_db import InvenioDB, db from invenio_records import InvenioRecords from invenio_records.api import Record @@ -71,7 +70,6 @@ 'sqlite:///app.db'), ) -FlaskCLI(app) FlaskCeleryExt(app) InvenioDB(app) InvenioRecords(app) diff --git a/invenio_indexer/__init__.py b/invenio_indexer/__init__.py index d2e90d7..55cc85c 100644 --- a/invenio_indexer/__init__.py +++ b/invenio_indexer/__init__.py @@ -33,14 +33,11 @@ Initialization -------------- -First create a Flask application (Flask-CLI is not needed for Flask -version 1.0+): +First create a Flask application: >>> from flask import Flask ->>> from flask_cli import FlaskCLI >>> app = Flask('myapp') >>> app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://' ->>> ext_cli = FlaskCLI(app) You initialize Indexer like a normal Flask extension, however Invenio-Indexer is dependent on Invenio-Records and Invenio-Search so you diff --git a/invenio_indexer/cli.py b/invenio_indexer/cli.py index 09e6187..73b654e 100644 --- a/invenio_indexer/cli.py +++ b/invenio_indexer/cli.py @@ -29,7 +29,7 @@ import click from celery.messaging import establish_connection from flask import current_app -from flask_cli import with_appcontext +from flask.cli import with_appcontext from invenio_records.models import RecordMetadata from invenio_search.cli import index diff --git a/setup.cfg b/setup.cfg index e79fb88..5ab9cba 100644 --- a/setup.cfg +++ b/setup.cfg @@ -33,21 +33,3 @@ all_files = 1 [bdist_wheel] universal = 1 - -[compile_catalog] -directory = invenio_indexer/translations/ - -[extract_messages] -copyright_holder = CERN -msgid_bugs_address = info@inveniosoftware.org -mapping-file = babel.ini -output-file = invenio_indexer/translations/messages.pot -add-comments = NOTE - -[init_catalog] -input-file = invenio_indexer/translations/messages.pot -output-dir = invenio_indexer/translations/ - -[update_catalog] -input-file = invenio_indexer/translations/messages.pot -output-dir = invenio_indexer/translations/ diff --git a/setup.py b/setup.py index d1de4e1..6506b95 100644 --- a/setup.py +++ b/setup.py @@ -25,10 +25,8 @@ """Indexer for Invenio.""" import os -import sys from setuptools import find_packages, setup -from setuptools.command.test import test as TestCommand readme = open('README.rst').read() history = open('CHANGES.rst').read() @@ -63,6 +61,7 @@ ] install_requires = [ + 'Flask>=0.11.1', 'celery>=3.1.19', 'invenio-records>=1.0.0a8', 'invenio-search>=1.0.0a4', @@ -71,12 +70,6 @@ packages = find_packages() - - - - - - # Get the version string. Cannot be done with import! g = {} with open(os.path.join('invenio_indexer', 'version.py'), 'rt') as fp: @@ -110,6 +103,7 @@ }, extras_require=extras_require, install_requires=install_requires, + setup_requires=setup_requires, tests_require=tests_require, classifiers=[ 'Environment :: Web Environment', diff --git a/tests/conftest.py b/tests/conftest.py index 81401e7..2808da6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -33,8 +33,8 @@ import pytest from celery.messaging import establish_connection from flask import Flask +from flask.cli import ScriptInfo from flask_celeryext import FlaskCeleryExt -from flask_cli import FlaskCLI, ScriptInfo from invenio_db import InvenioDB, db from invenio_records import InvenioRecords from invenio_search import InvenioSearch @@ -62,7 +62,6 @@ def app(request): SQLALCHEMY_TRACK_MODIFICATIONS=True, TESTING=True, ) - FlaskCLI(app) FlaskCeleryExt(app) InvenioDB(app) InvenioRecords(app) diff --git a/tests/test_utils.py b/tests/test_utils.py index 17446e5..80c82e1 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -28,7 +28,7 @@ from __future__ import absolute_import, print_function from click.testing import CliRunner -from flask_cli import ScriptInfo +from flask.cli import ScriptInfo from flask_sqlalchemy import models_committed from invenio_db import db from invenio_search.cli import index as cmd