From 8dde1695ac2e201508824fac84dd3cc23c3ba144 Mon Sep 17 00:00:00 2001 From: jmoore Date: Wed, 28 Aug 2019 12:25:04 +0200 Subject: [PATCH 1/8] Bump to 5.5.1 and update setup.py for release --- .gitignore | 2 ++ README.rst | 55 +++++++++++++++++++++++++++++++++++++++++ setup.py | 58 +++++++++++++++++++++----------------------- src/omero_version.py | 2 +- 4 files changed, 86 insertions(+), 31 deletions(-) create mode 100644 README.rst diff --git a/.gitignore b/.gitignore index fdda95af7..6380dcef4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ *.pyc var build +dist/ +target/ diff --git a/README.rst b/README.rst new file mode 100644 index 000000000..350d037b7 --- /dev/null +++ b/README.rst @@ -0,0 +1,55 @@ +OMERO.py +======== + +Introduction +------------ + +OMERO.py provides Python bindings to the OMERO.blitz server +as well as a pluggable command-line interface. + +Dependencies +------------ + +Direct dependencies of OMERO.py are: + +- `ZeroC IcePy`_ + +Installation +------------ + +See: `OMERO`_ documentation + +Usage +----- + +See: `OMERO`_ documentation + +Contributing +------------ + +See: `OMERO`_ documentation + +Running tests +------------- + +Unit tests are located under the `test` directory and can be run with pytest. + +Integration tests +^^^^^^^^^^^^^^^^^ + +Integration tests are stored in the main repository (ome/openmicroscopy) and depend on the +OMERO integration testing framework. Reading about `Running and writing tests`_ in the `OMERO`_ documentation +is essential. + +License +------- + +OMERO.py is released under the AGPL. + +Copyright +--------- + +2009-2019, The Open Microscopy Environment, Glencoe Software, Inc. + +.. _ZeroC IcePy: https://zeroc.com/ +.. _Running and writing tests: https://docs.openmicroscopy.org/latest/omero/developers/testing.html diff --git a/setup.py b/setup.py index 71ca6a5d9..6cf85418b 100644 --- a/setup.py +++ b/setup.py @@ -1,34 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- """ - setuptools entry point + Copyright 2008-2019 The Open Microscopy Environment, Glencoe Software, Inc. + All rights reserved. - Tests run by default using the OmeroPy/dist egg as the omero python lib but - you can override that by using the --test-pythonpath flag to ./setup.py - test. - - For testing that require a running Omero server, the ice.config file must - exist and hold the proper configuration either at the same directory as - this file or in some place pointed to by the --test-ice-config flag to - ./setup.py test. - - For example: - - # this will run all tests under OmeroPy/test/ - ./setup.py test - # run all tests under OmeroPy/test/gatewaytest - ./setup.py test -s test/gatewaytest - # run all tests that include TopLevelObjects in the name - ./setup.py test -k TopLevelObjects - # exit on first failure - ./setup.py test -x - # drop to the pdb debugger on failure - ./setup.py test --pdb - - - Copyright 2007-2016 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt - """ import glob @@ -68,23 +44,45 @@ url = 'https://docs.openmicroscopy.org/latest/omero/developers' sys.path.append("target") -from omero_setup import PyTest from omero_version import omero_version as ov + +def read(fname): + """ + Utility function to read the README file. + :rtype : String + """ + return open(os.path.join(os.path.dirname(__file__), fname)).read() + + setup( name="omero-py", version=ov, description="Python bindings to the OMERO.blitz server", - long_description="Python bindings to the OMERO.blitz server.", + long_description=read("README.rst"), + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'Intended Audience :: Science/Research', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: GNU General Public License v2 ' + 'or later (GPLv2+)', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Programming Language :: Python :: 2', + 'Topic :: Software Development :: Libraries :: Python Modules', + ], # Get strings from + # http://pypi.python.org/pypi?%3Aaction=list_classifiers author="The Open Microscopy Team", author_email="ome-devel@lists.openmicroscopy.org.uk", url=url, - download_url=url, package_dir={"": "target/"}, packages=packages, package_data={ 'omero.gateway': ['pilfonts/*'], 'omero.gateway.scripts': ['imgs/*']}, - cmdclass={'test': PyTest}, scripts=glob.glob(os.path.sep.join(["bin", "*"])), + install_requires=[ + # No Ice included, since a native wheel is preferable + ], tests_require=['pytest<3']) diff --git a/src/omero_version.py b/src/omero_version.py index 13f75157e..9aa1e1830 100644 --- a/src/omero_version.py +++ b/src/omero_version.py @@ -1,3 +1,3 @@ -omero_version = "5.5.dev1" +omero_version = "5.5.1" ice_compatibility = "3.6.4" build_year = "2019" From 972e71bd327ca55a6fd203fd6f413398f99fc9ff Mon Sep 17 00:00:00 2001 From: jmoore Date: Wed, 28 Aug 2019 12:27:58 +0200 Subject: [PATCH 2/8] Fix license info in README --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 350d037b7..5ab75f214 100644 --- a/README.rst +++ b/README.rst @@ -44,7 +44,7 @@ is essential. License ------- -OMERO.py is released under the AGPL. +OMERO.py is released under the GPL v2. Copyright --------- From ee340a8f85b012ba22efd91a07bcc79b8984229d Mon Sep 17 00:00:00 2001 From: jmoore Date: Wed, 28 Aug 2019 12:32:38 +0200 Subject: [PATCH 3/8] Pacify flake8 --- setup.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/setup.py b/setup.py index 6cf85418b..dfe759d86 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ from urllib import urlopen from zipfile import ZipFile -blitz_zip = "https://artifacts.openmicroscopy.org/artifactory/ome.releases/org/openmicroscopy/omero-blitz/5.5.3/omero-blitz-5.5.3-python.zip" +blitz_zip = "https://artifacts.openmicroscopy.org/artifactory/ome.releases/org/openmicroscopy/omero-blitz/5.5.3/omero-blitz-5.5.3-python.zip" # noqa blitz_md5 = "cf9c0cd4b2e499fc3b4b8be8c58ab6cb" if not os.path.exists("target"): @@ -44,7 +44,7 @@ url = 'https://docs.openmicroscopy.org/latest/omero/developers' sys.path.append("target") -from omero_version import omero_version as ov +from omero_version import omero_version as ov # noqa def read(fname): @@ -60,19 +60,19 @@ def read(fname): version=ov, description="Python bindings to the OMERO.blitz server", long_description=read("README.rst"), - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Intended Audience :: Science/Research', - 'Intended Audience :: System Administrators', - 'License :: OSI Approved :: GNU General Public License v2 ' - 'or later (GPLv2+)', - 'Natural Language :: English', - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 2', - 'Topic :: Software Development :: Libraries :: Python Modules', - ], # Get strings from - # http://pypi.python.org/pypi?%3Aaction=list_classifiers + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'Intended Audience :: Science/Research', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: GNU General Public License v2 ' + 'or later (GPLv2+)', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Programming Language :: Python :: 2', + 'Topic :: Software Development :: Libraries :: Python Modules', + ], # Get strings from + # http://pypi.python.org/pypi?%3Aaction=list_classifiers author="The Open Microscopy Team", author_email="ome-devel@lists.openmicroscopy.org.uk", url=url, From 097318ccebdea8c4913618dbdd5042a7f73ab065 Mon Sep 17 00:00:00 2001 From: jmoore Date: Thu, 29 Aug 2019 15:33:53 +0100 Subject: [PATCH 4/8] Remove test_web.py as well --- test/unit/clitest/test_web.py | 501 ---------------------------------- 1 file changed, 501 deletions(-) delete mode 100644 test/unit/clitest/test_web.py diff --git a/test/unit/clitest/test_web.py b/test/unit/clitest/test_web.py deleted file mode 100644 index 7b2a6a2ca..000000000 --- a/test/unit/clitest/test_web.py +++ /dev/null @@ -1,501 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# -# Copyright (C) 2015 University of Dundee & Open Microscopy Environment. -# All rights reserved. -# -# 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; either version 2 of the License, or -# (at your option) any later version. -# -# 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., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -import pytest -from difflib import unified_diff -import re -import os -from path import path -import getpass -import Ice -import omero.cli -from omero.plugins.web import ( - APACHE_MOD_WSGI_ERR, - WebControl -) -from omeroweb import settings - - -class TestWeb(object): - - def setup_method(self, method): - self.cli = omero.cli.CLI() - self.cli.register("web", WebControl, "TEST") - self.args = ["web"] - - def set_templates_dir(self, monkeypatch): - - dist_dir = path(__file__) / ".." / ".." / ".." / ".." / ".." / ".." /\ - ".." / "dist" # FIXME: should not be hard-coded - dist_dir = dist_dir.abspath() - monkeypatch.setattr(WebControl, '_get_web_templates_dir', - lambda x: dist_dir / "etc" / "templates" / "web") - - def set_python_path(self, monkeypatch, python_path=None): - if python_path: - monkeypatch.setenv('PYTHONPATH', python_path) - else: - monkeypatch.delenv('PYTHONPATH') - - def set_python_dir(self, monkeypatch): - - dist_dir = path(__file__) / ".." / ".." / ".." / ".." / ".." /\ - "target" # FIXME: should not be hard-coded - dist_dir = dist_dir.abspath() - monkeypatch.setattr(WebControl, '_get_python_dir', - lambda x: dist_dir / "lib" / "python") - - def mock_os_kill(self, monkeypatch, error=False): - def os_kill(pid, signal): - if error: - raise OSError() - return None - monkeypatch.setattr(os, 'kill', os_kill) - - def mock_subprocess_popen(self, monkeypatch): - def subprocess_popen(*args, **kwargs): - return 0 - monkeypatch.setattr(omero.cli.CLI, 'popen', subprocess_popen) - - def mock_subprocess_call(self, monkeypatch): - def subprocess_call(*args, **kwargs): - return 0 - monkeypatch.setattr(omero.cli.CLI, 'call', subprocess_call) - - def check_django_pid(self, monkeypatch, error=False): - def check_pid(self, pid, path): - return not error - monkeypatch.setattr(WebControl, '_check_pid', check_pid) - - def set_django_pid(self, monkeypatch, pid=None): - def django_pid(self, path): - return pid - monkeypatch.setattr(WebControl, '_get_django_pid', django_pid) - - def add_prefix(self, prefix, monkeypatch): - - def _get_default_value(x): - return settings.CUSTOM_SETTINGS_MAPPINGS[x][1] - if prefix: - static_prefix = prefix + '-static/' - else: - prefix = _get_default_value('omero.web.prefix') - static_prefix = _get_default_value('omero.web.static_url') - monkeypatch.setattr(settings, 'STATIC_URL', static_prefix, - raising=False) - monkeypatch.setattr(settings, 'FORCE_SCRIPT_NAME', prefix, - raising=False) - return static_prefix - - def mock_django_setting(self, setting_name, setting_val, monkeypatch): - if setting_val: - monkeypatch.setattr(settings, setting_name, setting_val, - raising=False) - return setting_val - - def add_upstream_name(self, prefix, monkeypath): - if prefix: - name = "omeroweb_%s" % re.sub(r'\W+', '', prefix) - else: - name = "omeroweb" - return name - - def add_hostport(self, host, port, monkeypatch): - if host: - monkeypatch.setattr(settings, 'APPLICATION_SERVER_HOST', host, - raising=False) - if port: - monkeypatch.setattr(settings, 'APPLICATION_SERVER_PORT', port, - raising=False) - return '%s:%s' % (host or '127.0.0.1', port or '4080') - - def clean_generated_file(self, txt): - assert "%(" not in txt # Make sure all markers have been replaced - lines = [line.strip() for line in txt.split('\n')] - lines = [line for line in lines if line and not line.startswith('#')] - return lines - - def required_lines_in(self, required, lines): - # Checks that all lines in required are present in the same order, - # but not necessarily consecutively - def compare(req, line): - if isinstance(req, tuple): - return line.startswith(req[0]) and line.endswith(req[1]) - return req == line - - n = 0 - for req in required: - while not compare(req, lines[n]): - n += 1 - if n == len(lines): - return req - return None - - def normalise_generated(self, s): - serverdir = self.cli.dir - s = re.sub('\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{6}', - '0000-00-00 00:00:00.000000', s) - s = s.replace(serverdir, '/home/omero/OMERO.server') - s = s.replace(os.path.dirname(Ice.__file__), '/home/omero/ice/python') - s = s.replace('user=%s' % getpass.getuser(), 'user=omero') - return s - - def compare_with_reference(self, refname, generated): - reffile = path(__file__).dirname() / 'reference_templates' / refname - generated = generated.split('\n') - # reffile.write_lines(generated) - ref = reffile.lines(retain=False) - d = '\n'.join(unified_diff(ref, generated)) - return d - - def testHelp(self): - self.args += ["-h"] - self.cli.invoke(self.args, strict=True) - - @pytest.mark.parametrize('subcommand', WebControl().get_subcommands()) - def testSubcommandHelp(self, subcommand): - self.args += [subcommand, "-h"] - self.cli.invoke(self.args, strict=True) - - @pytest.mark.parametrize('app_server', ['wsgi', 'wsgi-tcp', 'development']) - def testWebStart(self, app_server, monkeypatch, capsys): - self.mock_django_setting('APPLICATION_SERVER', app_server, monkeypatch) - self.set_python_dir(monkeypatch) - self.mock_subprocess_popen(monkeypatch) - self.mock_subprocess_call(monkeypatch) - self.set_django_pid(monkeypatch) - self.args += ["start"] - self.cli.invoke(self.args, strict=(app_server not in ('wsgi',))) - o, e = capsys.readouterr() - csout = "Clearing expired sessions. This may take some time... [OK]" - assert csout == o.split(os.linesep)[0] - if app_server in ('wsgi',): - assert APACHE_MOD_WSGI_ERR == e.split(os.linesep)[0] - assert 1 == len(e.split(os.linesep))-1 - elif app_server in ('wsgi-tcp',): - startout = "Starting OMERO.web... [OK]" - assert startout == o.split(os.linesep)[1] - assert 2 == len(o.split(os.linesep))-1 - elif app_server in ('development',): - startout = "Starting OMERO.web... [OK]" - assert startout == o.split(os.linesep)[1] - assert 2 == len(o.split(os.linesep))-1 - - @pytest.mark.parametrize('app_server', ['wsgi', 'wsgi-tcp', 'development']) - def testWebRestart(self, app_server, monkeypatch, capsys): - self.mock_django_setting('APPLICATION_SERVER', app_server, monkeypatch) - self.set_python_dir(monkeypatch) - self.mock_subprocess_popen(monkeypatch) - self.set_django_pid(monkeypatch) - self.args += ["restart"] - self.cli.invoke(self.args, strict=True) - o, e = capsys.readouterr() - if app_server in ('wsgi',): - assert APACHE_MOD_WSGI_ERR in e.split(os.linesep)[0] - assert 1 == len(e.split(os.linesep))-1 - elif app_server in ('wsgi-tcp',): - stdout = ( - "Stopping OMERO.web... [NOT STARTED]", - "Clearing expired sessions. This may take some time... [OK]", - "Starting OMERO.web... [OK]" - ) - for msg in stdout: - assert msg in o.split(os.linesep) - assert 3 == len(o.split(os.linesep))-1 - elif app_server in ('development',): - stderr = "DEVELOPMENT: You will have to kill processes by hand!" - assert stderr in e.split(os.linesep)[0] - assert 1 == len(e.split(os.linesep))-1 - - @pytest.mark.parametrize('app_server', ['wsgi-tcp']) - def testWebStop(self, app_server, monkeypatch, capsys): - self.mock_django_setting('APPLICATION_SERVER', app_server, monkeypatch) - self.set_python_dir(monkeypatch) - self.mock_os_kill(monkeypatch) - self.check_django_pid(monkeypatch) - self.set_django_pid(monkeypatch, -999999) - self.args += ["stop"] - self.cli.invoke(self.args, strict=True) - o, e = capsys.readouterr() - stdout = ("Stopping OMERO.web... [OK]", - "OMERO.web WSGI workers (PID -999999) killed.") - assert 2 == len(o.split(os.linesep))-1 - for msg in stdout: - assert msg in o.split(os.linesep) - - @pytest.mark.parametrize('app_server', ['wsgi-tcp']) - def testWebBadRestart(self, app_server, monkeypatch, capsys): - self.mock_django_setting('APPLICATION_SERVER', app_server, monkeypatch) - self.set_python_dir(monkeypatch) - self.mock_os_kill(monkeypatch) - self.set_django_pid(monkeypatch, -999999) - self.args += ["restart"] - self.cli.invoke(self.args, strict=False) - o, e = capsys.readouterr() - stdout = ( - "Stopping OMERO.web... [OK]", - "OMERO.web WSGI workers (PID -999999) killed.", - "Clearing expired sessions. This may take some time... [OK]", - "Starting OMERO.web... " - ) - for msg in stdout: - assert msg in o.split(os.linesep) - assert 4 == len(o.split(os.linesep)) - stderr = ("[FAILED] OMERO.web already started. " - "%s/var/django.pid exists (PID: -999999)! " - "Use 'web stop or restart' first.") % str(self.cli.dir) - assert stderr == e.split(os.linesep)[0] - assert 1 == len(e.split(os.linesep))-1 - - @pytest.mark.parametrize('app_server', ['wsgi-tcp']) - def testWebStale(self, app_server, monkeypatch, capsys): - self.mock_django_setting('APPLICATION_SERVER', app_server, monkeypatch) - self.set_python_dir(monkeypatch) - self.mock_os_kill(monkeypatch, error=True) - self.set_django_pid(monkeypatch, -999999) - self.args += ["stop"] - self.cli.invoke(self.args, strict=False) - o, e = capsys.readouterr() - - stdout = ( - "Stopping OMERO.web... ", - ) - for msg in stdout: - assert msg in o.split(os.linesep) - stderr = ("[ERROR] OMERO.web workers (PID -999999) - no such process." - " Use `ps aux | grep %s/var/django.pid` and kill stale" - " processes by hand.") % str(self.cli.dir) - assert stderr == e.split(os.linesep)[0] - - @pytest.mark.parametrize('app_server', ['wsgi-tcp']) - @pytest.mark.parametrize('wsgi_args', [None, "", '--reload']) - def testWebWsgiArgs(self, app_server, wsgi_args, monkeypatch, capsys): - self.mock_django_setting('WSGI_ARGS', wsgi_args, monkeypatch) - self.mock_django_setting('APPLICATION_SERVER', app_server, monkeypatch) - self.set_python_dir(monkeypatch) - self.mock_subprocess_popen(monkeypatch) - self.mock_subprocess_call(monkeypatch) - self.set_django_pid(monkeypatch) - start_cmd = ["start"] - if wsgi_args is not None: - start_cmd.append("--wsgi-args='%s'" % wsgi_args) - self.cli.invoke(self.args + start_cmd, strict=True) - o, e = capsys.readouterr() - if wsgi_args is not None: - startout = ("Starting OMERO.web... `--wsgi-args` is deprecated" - " and overwritten by `omero.web.wsgi_args`. [OK]") - else: - startout = "Starting OMERO.web... [OK]" - assert startout == o.split(os.linesep)[1] - assert 2 == len(o.split(os.linesep))-1 - - @pytest.mark.parametrize('app_server', ['wsgi-tcp']) - @pytest.mark.parametrize('wsgi_workers', [None, 1]) - def testWebWorkers(self, app_server, wsgi_workers, monkeypatch, capsys): - self.mock_django_setting('WSGI_WORKERS', wsgi_workers, monkeypatch) - self.mock_django_setting('APPLICATION_SERVER', app_server, monkeypatch) - self.set_python_dir(monkeypatch) - self.mock_subprocess_popen(monkeypatch) - self.mock_subprocess_call(monkeypatch) - self.set_django_pid(monkeypatch) - start_cmd = ["start"] - if wsgi_workers is not None: - start_cmd.append("--workers=%r" % wsgi_workers) - self.cli.invoke(self.args + start_cmd, strict=True) - o, e = capsys.readouterr() - if wsgi_workers is not None: - startout = ("Starting OMERO.web... `--workers` is deprecated" - " and overwritten by `omero.web.wsgi_workers`. [OK]") - else: - startout = "Starting OMERO.web... [OK]" - assert startout == o.split(os.linesep)[1] - assert 2 == len(o.split(os.linesep))-1 - - @pytest.mark.parametrize('app_server', ['wsgi-tcp']) - @pytest.mark.parametrize('wsgi_worker_conn', [None, 1]) - def testWebWorkerConnections(self, app_server, wsgi_worker_conn, - monkeypatch, capsys): - self.mock_django_setting('WSGI_WORKER_CONNECTIONS', wsgi_worker_conn, - monkeypatch) - self.mock_django_setting('APPLICATION_SERVER', app_server, monkeypatch) - self.set_python_dir(monkeypatch) - self.mock_subprocess_popen(monkeypatch) - self.mock_subprocess_call(monkeypatch) - self.set_django_pid(monkeypatch) - start_cmd = ["start"] - if wsgi_worker_conn is not None: - start_cmd.append("--worker-connections=%r" % wsgi_worker_conn) - self.cli.invoke(self.args + start_cmd, strict=True) - o, e = capsys.readouterr() - if wsgi_worker_conn is not None: - startout = ("Starting OMERO.web... `--worker-connections` is" - " deprecated and overwritten by " - "`omero.web.wsgi_worker_connections`. [OK]") - else: - startout = "Starting OMERO.web... [OK]" - assert startout == o.split(os.linesep)[1] - assert 2 == len(o.split(os.linesep))-1 - - @pytest.mark.parametrize('max_body_size', [None, '0', '1m']) - @pytest.mark.parametrize('server_type', [ - "nginx", "nginx-development"]) - @pytest.mark.parametrize('http', [False, 8081]) - @pytest.mark.parametrize('servername', [False, "omeroweb.host"]) - @pytest.mark.parametrize('prefix', [None, '/test']) - @pytest.mark.parametrize('app_server', ['wsgi-tcp']) - @pytest.mark.parametrize('cgihost', [None, '0.0.0.0']) - @pytest.mark.parametrize('cgiport', [None, '12345']) - def testNginxGunicornConfig(self, server_type, http, servername, prefix, - app_server, cgihost, cgiport, max_body_size, - capsys, monkeypatch): - - self.mock_django_setting('APPLICATION_SERVER', app_server, monkeypatch) - static_prefix = self.add_prefix(prefix, monkeypatch) - upstream_name = self.add_upstream_name(prefix, monkeypatch) - expected_cgi = self.add_hostport(cgihost, cgiport, monkeypatch) - - self.args += ["config"] - self.args += server_type.split() - if http: - self.args += ["--http", str(http)] - if servername: - self.args += ["--servername", str(servername)] - if max_body_size: - self.args += ["--max-body-size", max_body_size] - self.set_templates_dir(monkeypatch) - self.cli.invoke(self.args, strict=True) - o, e = capsys.readouterr() - lines = self.clean_generated_file(o) - - if "development" in server_type: - missing = self.required_lines_in([ - "upstream %s {" % upstream_name, - "server %s fail_timeout=0;" % expected_cgi, - "server {", - "listen %s;" % (http or 8080), - "server_name _;", - "client_max_body_size %s;" % (max_body_size or '0'), - "location %s {" % static_prefix[:-1], - "location %s {" % (prefix or "/"), - ], lines) - else: - missing = self.required_lines_in([ - "upstream %s {" % upstream_name, - "server %s fail_timeout=0;" % expected_cgi, - "server {", - "listen %s;" % (http or 80), - "server_name %s;" % (servername or "$hostname"), - "client_max_body_size %s;" % (max_body_size or '0'), - "location %s {" % static_prefix[:-1], - "location %s {" % (prefix or "/"), - ], lines) - assert not missing, 'Line not found: ' + str(missing) - - @pytest.mark.parametrize('server_type', [ - ["nginx", 'wsgi-tcp'], - ["nginx-development", 'wsgi-tcp'], - ["nginx-location", 'wsgi-tcp'], - ]) - @pytest.mark.parametrize('static_root', [ - '/home/omero/OMERO.server/lib/python/omeroweb/static']) - def testFullTemplateDefaults(self, server_type, static_root, - capsys, monkeypatch): - app_server = server_type[-1] - del server_type[-1] - self.mock_django_setting('STATIC_ROOT', static_root, monkeypatch) - self.mock_django_setting('APPLICATION_SERVER', app_server, monkeypatch) - self.args += ["config"] + server_type - self.set_templates_dir(monkeypatch) - self.set_python_path(monkeypatch) - self.cli.invoke(self.args, strict=True) - - o, e = capsys.readouterr() - o = self.normalise_generated(o) - d = self.compare_with_reference(server_type[0] + '.conf', o) - assert not d, 'Files are different:\n' + d - - @pytest.mark.parametrize('server_type', [ - ['nginx', '--http', '1234', - '--servername', 'omeroweb.host', - '--max-body-size', '2m', 'wsgi-tcp'], - ['nginx-development', '--http', '1234', - '--servername', 'omeroweb.host', - '--max-body-size', '2m', 'wsgi-tcp'], - ['nginx-location', '--http', '1234', - '--servername', 'omeroweb.host', - '--max-body-size', '2m', 'wsgi-tcp'], - ]) - @pytest.mark.parametrize('static_root', [ - '/home/omero/OMERO.server/lib/python/omeroweb/static']) - def testFullTemplateWithOptions(self, server_type, static_root, - capsys, monkeypatch): - prefix = '/test' - cgihost = '0.0.0.0' - cgiport = '12345' - app_server = server_type[-1] - del server_type[-1] - self.mock_django_setting('STATIC_ROOT', static_root, monkeypatch) - self.mock_django_setting('APPLICATION_SERVER', app_server, monkeypatch) - self.add_prefix(prefix, monkeypatch) - self.add_hostport(cgihost, cgiport, monkeypatch) - - self.args += ["config"] + server_type - self.set_templates_dir(monkeypatch) - self.set_python_path(monkeypatch) - self.cli.invoke(self.args, strict=True) - - o, e = capsys.readouterr() - o = self.normalise_generated(o) - d = self.compare_with_reference( - server_type[0] + '-withoptions.conf', o) - assert not d, 'Files are different:\n' + d - - def testNginxLocationComment(self): - """ - Check the example comment in nginx-location matches the recommended - nginx configuration - """ - - def clean(refname): - fn = path(__file__).dirname() / 'reference_templates' / refname - out = [] - with open(fn) as f: - for line in f: - if re.match('##\s*\w', line): - out.append(line[2:].strip()) - elif re.match('[^#]\s*\w', line): - out.append(line.strip()) - return out - - diffs = list(unified_diff( - clean('nginx.conf'), clean('nginx-location.conf'), n=0)) - assert diffs == [ - '--- \n', - '+++ \n', - '@@ -1,2 +0,0 @@\n', - '-upstream omeroweb {', - '-server 127.0.0.1:4080 fail_timeout=0;', - '@@ -7,0 +6 @@\n', - '+include /opt/omero/web/omero-web-location.include;', - '@@ -19 +18 @@\n', - '-proxy_pass http://omeroweb;', - '+proxy_pass http://127.0.0.1:4080;' - ] From 6e3db39584e3968975d9ed9674383958b2a0b113 Mon Sep 17 00:00:00 2001 From: Simon Li Date: Thu, 29 Aug 2019 14:02:06 +0100 Subject: [PATCH 5/8] install_requires zeroc-ice --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index dfe759d86..affaaafd1 100644 --- a/setup.py +++ b/setup.py @@ -83,6 +83,6 @@ def read(fname): 'omero.gateway.scripts': ['imgs/*']}, scripts=glob.glob(os.path.sep.join(["bin", "*"])), install_requires=[ - # No Ice included, since a native wheel is preferable + 'zeroc-ice>=3.6.4,<3.7', ], tests_require=['pytest<3']) From e1425cab3e59ed4e668555b61f0b065a93b4642f Mon Sep 17 00:00:00 2001 From: Simon Li Date: Thu, 29 Aug 2019 16:35:49 +0100 Subject: [PATCH 6/8] Build in travis (manylinux ice) --- .travis.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0cf761b51..de76215d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,15 @@ language: python python: - "2.7" -services: - - docker +before_install: + - pip install https://github.com/manics/zeroc-ice-py-manylinux/releases/download/0.0.10/zeroc_ice-3.6.4-cp27-cp27mu-manylinux2010_x86_64.whl + - python -c "import Ice; print Ice.stringVersion()" script: - - docker build -t omero-py . + - python setup.py sdist + - pip install dist/omero-py*gz + - python -c "import omero_version; print omero_version.omero_version" + - omero version deploy: provider: pypi From 949589cc3cfe3c96e4ef88a42f08720a844f1a08 Mon Sep 17 00:00:00 2001 From: Josh Moore Date: Thu, 29 Aug 2019 18:07:28 +0200 Subject: [PATCH 7/8] Use transferred url --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index de76215d8..e8c871a48 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ python: - "2.7" before_install: - - pip install https://github.com/manics/zeroc-ice-py-manylinux/releases/download/0.0.10/zeroc_ice-3.6.4-cp27-cp27mu-manylinux2010_x86_64.whl + - pip install https://github.com/ome/zeroc-ice-py-manylinux/releases/download/0.0.10/zeroc_ice-3.6.4-cp27-cp27mu-manylinux2010_x86_64.whl - python -c "import Ice; print Ice.stringVersion()" script: From 526a1ee7a3eea7618d02ca1b39fc866475c2246b Mon Sep 17 00:00:00 2001 From: Josh Moore Date: Thu, 29 Aug 2019 18:14:36 +0200 Subject: [PATCH 8/8] Revert to dev2 for testing Ice dependency --- src/omero_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/omero_version.py b/src/omero_version.py index 9aa1e1830..f8531a1b7 100644 --- a/src/omero_version.py +++ b/src/omero_version.py @@ -1,3 +1,3 @@ -omero_version = "5.5.1" +omero_version = "5.5.dev2" ice_compatibility = "3.6.4" build_year = "2019"