Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal of python-future compatibility #6377

Merged
merged 16 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/source_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,22 @@ jobs:
build_bf: [false]
build_zarr: [false]
build_snapshot: [false]
python-version:
- '3.10'
- '3.11'
- '3.12'
name: Build OMERO from source
runs-on: ubuntu-22.04
env:
ICE_HOME: /opt/ice-3.6.5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Ice and Ice python binding
if: matrix.build_snapshot
uses: ome/action-ice@v3
uses: jburel/action-ice@v3
- name: Set up Gradle 6.8.3
if: matrix.build_snapshot
uses: gradle/gradle-build-action@v2
Expand All @@ -30,7 +37,7 @@ jobs:
build-root-directory: components/tools/OmeroJava # required by the action to have a *.gradle file"
- name: Install and run flake8
run: |
pip install flake8
pip install flake8 'setuptools<69'
flake8 .
- name: install dependencies
run: |
Expand Down
1 change: 0 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#
# General build scripts.

from builtins import str
import os
import sys
import subprocess
Expand Down
3 changes: 0 additions & 3 deletions components/antlib/scripts/parse_version
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
"""
Helper script to simpliy version.xml
"""
from __future__ import print_function

from builtins import str
from builtins import range
import os
import re
import sys
Expand Down
2 changes: 0 additions & 2 deletions components/antlib/scripts/source-archive.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/python

from __future__ import print_function

import os
from subprocess import call, Popen, PIPE
import sys
Expand Down
1 change: 0 additions & 1 deletion components/tools/OmeroFS/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

"""

from builtins import map
import glob
import sys
import os
Expand Down
17 changes: 4 additions & 13 deletions components/tools/OmeroFS/test/drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,15 @@
Use is subject to license terms supplied in LICENSE.txt

"""
from __future__ import division

from builtins import str
from builtins import range
from builtins import object
from past.utils import old_div
import logging
import threading
import time
import uuid

import omero.grid.monitors as monitors

try:
from omero_ext.path import path
except ImportError:
# Python 2
from path import path
from omero_ext.path import path
from omero.util import ServerContext
from functools import wraps
from omero.util.temp_files import create_path
Expand Down Expand Up @@ -69,7 +60,7 @@ def run(self):
By default, nothing.
"""
self.log.info("Sleeping %s" % self.waitMillis)
time.sleep(old_div(self.waitMillis, 1000))
time.sleep(self.waitMillis / 1000)
if not self.client:
self.log.error("No client")
self.doRun()
Expand Down Expand Up @@ -160,7 +151,7 @@ def with_driver(func, errors=0):
""" Decorator for running a test with a Driver """
def handler(*args, **kwargs):
self = args[0]
self.dir = old_div(create_path(folder=True), "DropBox")
self.dir = create_path(folder=True) / "DropBox"
self.simulator = Simulator(self.dir)
self.client = MockMonitor(self.dir, pre=[self.simulator], post=[])
try:
Expand Down Expand Up @@ -310,7 +301,7 @@ def fsEventHappened(self, monitorid, eventList, current=None):
if not file.isdir():
raise Exception("%s is not a directory" % file)
self.log.info("Creating file in dir %s", file)
new_file = old_div(file, str(uuid.uuid4()))
new_file = file / str(uuid.uuid4())
new_file.write_lines(
["Writing new file to modify this"
"directory on event: %s" % event])
Expand Down
1 change: 0 additions & 1 deletion components/tools/OmeroFS/test/integration/test_dbclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

"""

from builtins import object
import os
import sys

Expand Down
2 changes: 0 additions & 2 deletions components/tools/OmeroPy/test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#


from builtins import range
from builtins import object
import pytest
import os

Expand Down
1 change: 0 additions & 1 deletion components/tools/OmeroPy/test/integration/clitest/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


from builtins import object
import pytest
import warnings

Expand Down
21 changes: 5 additions & 16 deletions components/tools/OmeroPy/test/integration/clitest/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,14 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


from __future__ import division
from builtins import str
from past.utils import old_div
import pytest
import os

from omero.testlib.cli import CLITest
from omero.testlib.cli import RootCLITest
import omero.plugins.admin
from omero.cli import NonZeroReturnCode
try:
from omero_ext.path import path
except ImportError:
# Python 2
from path import path
from omero_ext.path import path
from omero.util.upgrade_check import UpgradeCheck

OMERODIR = os.getenv('OMERODIR', None)
Expand All @@ -59,10 +52,8 @@ def setup_method(self, method):
self.cli.register("admin", omero.plugins.admin.AdminControl, "TEST")
# omero needs the etc/grid directory
self.cli.dir = (
old_div(old_div(old_div(old_div(
old_div(old_div(
old_div(path(__file__).dirname(), ".."),
".."), ".."), ".."), ".."), ".."), "dist"))
path(__file__).dirname() /
".." / ".." / ".." / ".." / ".." / ".." / "dist")
self.args += ["admin"]

def go(self):
Expand Down Expand Up @@ -114,10 +105,8 @@ def setup_method(self, method):
self.cli.register("admin", omero.plugins.admin.AdminControl, "TEST")
# omero needs the etc/grid directory
self.cli.dir = (
old_div(old_div(old_div(old_div(
old_div(old_div(
old_div(path(__file__).dirname(), ".."),
".."), ".."), ".."), ".."), ".."), "dist"))
path(__file__).dirname() /
".." / ".." / ".." / ".." / ".." / ".." / "dist")
self.args += ["admin"]

def test_log(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

from builtins import range
from future.utils import native_str
import omero
from omero.cli import NonZeroReturnCode
from omero.plugins.chgrp import ChgrpControl
Expand Down Expand Up @@ -64,7 +62,7 @@ def testChgrpMyData(self, object_type, target_group_perms, group_prefix):
# check the object has been moved
new_object = self.query.get(object_type, oid,
{'omero.group':
native_str(target_group.id.val)})
str(target_group.id.val)})
assert new_object.id.val == oid

def testNonMember(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

# from omero.cli import NonZeroReturnCode

from builtins import str
from builtins import range
import omero
from omero.plugins.chown import ChownControl
from omero.testlib.cli import CLITest, RootCLITest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


from future.utils import native_str
from omero.testlib.cli import CLITest
from omero.cli import NonZeroReturnCode
from omero.cmd import Delete2
Expand Down Expand Up @@ -59,7 +58,7 @@ def setup_method(self, method):
super(TestCleanseFullAdmin, self).setup_method(method)
self.cli.register("admin", omero.plugins.admin.AdminControl, "TEST")
self.args += ["admin", "cleanse"]
self.group_ctx = {'omero.group': native_str(self.group.id.val)}
self.group_ctx = {'omero.group': str(self.group.id.val)}
config_service = self.root.sf.getConfigService()
self.mrepo_dir = config_service.getConfigValue("omero.managed.dir")
self.data_dir = config_service.getConfigValue("omero.managed.dir")
Expand Down
5 changes: 0 additions & 5 deletions components/tools/OmeroPy/test/integration/clitest/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,13 @@

"""

from future import standard_library

from builtins import str
from builtins import object
import pytest
import os
from omero.plugins.db import DatabaseControl
from omero.util.temp_files import create_path
from omero.cli import NonZeroReturnCode
from omero.cli import CLI
import re
standard_library.install_aliases() # noqa


OMERODIR = False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

from builtins import str
from builtins import range
import omero
from omero.plugins.delete import DeleteControl
from omero.testlib.cli import CLITest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

from builtins import str
from builtins import object
import os
import pytest
import omero
Expand All @@ -33,12 +31,6 @@
from omero.model import NamedValue as NV
from omero.util.temp_files import create_path

try:
int
except Exception:
# Python 3
long = int


class TestDownload(CLITest):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

from builtins import str
from omero.plugins.group import GroupControl, defaultperms
from omero.cli import NonZeroReturnCode
from omero.testlib.cli import CLITest, RootCLITest
Expand Down
17 changes: 3 additions & 14 deletions components/tools/OmeroPy/test/integration/clitest/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

from __future__ import division
from __future__ import print_function
from builtins import str
from builtins import range
from past.utils import old_div
from builtins import object
from omero.testlib.cli import CLITest
import pytest
import stat
Expand All @@ -32,13 +26,8 @@
import omero
from omero.cli import NonZeroReturnCode
from omero.rtypes import rstring
try:
plugin = __import__('omero.plugins.import', globals(), locals(),
['ImportControl'], -1)
except ValueError:
# Python 3
plugin = __import__('omero.plugins.import', globals(), locals(),
['ImportControl'], 0)
plugin = __import__('omero.plugins.import', globals(), locals(),
['ImportControl'], 0)
ImportControl = plugin.ImportControl


Expand Down Expand Up @@ -177,7 +166,7 @@ def do_import(self, capfd, strip_logs=True):
return o, e

def add_client_dir(self):
client_dir = old_div(old_div(self.omero_dist, "lib"), "client")
client_dir = self.omero_dist / "lib" / "client"
self.args += ["--clientdir", client_dir]

def check_other_output(self, out, import_type='default'):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,15 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

from __future__ import division
from __future__ import print_function
from builtins import str
from past.utils import old_div
from omero.cli import NonZeroReturnCode
from omero.testlib.cli import CLITest
from omero.plugins.sessions import SessionsControl
import sys
import re
import subprocess

try:
plugin = __import__('omero.plugins.import', globals(), locals(),
['ImportControl'], -1)
except ValueError:
# Python 3
plugin = __import__('omero.plugins.import', globals(), locals(),
['ImportControl'], 0)
plugin = __import__('omero.plugins.import', globals(), locals(),
['ImportControl'], 0)
ImportControl = plugin.ImportControl


Expand Down Expand Up @@ -127,8 +118,7 @@ def testBulk(self, tmpdir, capfd, monkeypatch):
script = tmpdir.join("script1.sh")

self.args += ["import", "-f", "--bulk", str(yml),
"--clientdir", old_div(old_div(self.omero_dist, "lib"),
"client")]
"--clientdir", self.omero_dist / "lib" / "client"]

monkeypatch.setattr(sys, "argv", ["omero"])
out, err = self.do_import(capfd)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from omero.rtypes import rdouble, unwrap
from omero.testlib.cli import CLITest
from omero.model.enums import UnitsLength
from past.builtins import long

with warnings.catch_warnings():
warnings.simplefilter("ignore")
Expand All @@ -47,7 +46,7 @@ def setup_method(self, method):

conn = BlitzGateway(client_obj=self.client)
self.imageid = unwrap(self.image.getId())
assert type(self.imageid) is long
assert type(self.imageid) is int
wrapper = conn.getObject("Image", self.imageid)
self.md = Metadata(wrapper)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


from __future__ import print_function
from builtins import str
from omero.testlib.cli import CLITest
from omero.cli import NonZeroReturnCode
from omero.model import PixelsI
Expand Down
Loading
Loading