From 9f0471f5a0d9ec15994514f74980e5a825cd2428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Besson?= Date: Tue, 23 Jan 2024 20:54:20 +0000 Subject: [PATCH 01/15] Remove all imports of print_function compatibility method --- test/unit/test_replay.py | 1 - 1 file changed, 1 deletion(-) diff --git a/test/unit/test_replay.py b/test/unit/test_replay.py index 55e516f..dc2aa9f 100644 --- a/test/unit/test_replay.py +++ b/test/unit/test_replay.py @@ -8,7 +8,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from __future__ import print_function from builtins import object import pytest From 263d4ae3c256a471f317ca788a1282c1a86281b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Besson?= Date: Tue, 23 Jan 2024 21:08:50 +0000 Subject: [PATCH 02/15] Remove all imports of division compatibility method --- src/fsPyinotifyMonitor.py | 1 - test/drivers.py | 1 - test/unit/test_drivers.py | 1 - 3 files changed, 3 deletions(-) diff --git a/src/fsPyinotifyMonitor.py b/src/fsPyinotifyMonitor.py index 9fbc342..ae445dc 100644 --- a/src/fsPyinotifyMonitor.py +++ b/src/fsPyinotifyMonitor.py @@ -7,7 +7,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from __future__ import division from future.utils import bytes_to_native_str, isbytes from builtins import str from past.utils import old_div diff --git a/test/drivers.py b/test/drivers.py index da9388b..b40bd36 100644 --- a/test/drivers.py +++ b/test/drivers.py @@ -9,7 +9,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from __future__ import division from builtins import str from builtins import range diff --git a/test/unit/test_drivers.py b/test/unit/test_drivers.py index 26a78e0..2ade17f 100644 --- a/test/unit/test_drivers.py +++ b/test/unit/test_drivers.py @@ -9,7 +9,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from __future__ import division from builtins import str from builtins import range From e91ab4d93884ced38da4da1ff26b2295786328dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Besson?= Date: Tue, 23 Jan 2024 21:12:18 +0000 Subject: [PATCH 03/15] Replace all instances of isbytes and bytes_to_native_str Use isinstance(x, bytes) and x.decode("utf-8") --- src/fsMonitorServer.py | 6 +++--- src/fsPyinotifyMonitor.py | 7 +++---- src/fsUtil.py | 9 ++++----- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/fsMonitorServer.py b/src/fsMonitorServer.py index 8b6286d..9d616e1 100644 --- a/src/fsMonitorServer.py +++ b/src/fsMonitorServer.py @@ -8,7 +8,7 @@ """ from builtins import str -from future.utils import native_str, bytes_to_native_str, isbytes +from future.utils import native_str import logging import uuid @@ -246,8 +246,8 @@ def callback(self, monitorId, fileList): eventList = [] for fileEvent in fileList: fileId = fileEvent[0] - if isbytes(fileId): - fileId = bytes_to_native_str(fileId) + if isinstance(fileId, bytes): + fileId = fileId.decode("utf-8") info = monitors.EventInfo(fileId, fileEvent[1]) eventList.append(info) diff --git a/src/fsPyinotifyMonitor.py b/src/fsPyinotifyMonitor.py index ae445dc..515def5 100644 --- a/src/fsPyinotifyMonitor.py +++ b/src/fsPyinotifyMonitor.py @@ -7,7 +7,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from future.utils import bytes_to_native_str, isbytes from builtins import str from past.utils import old_div from builtins import object @@ -175,8 +174,8 @@ def addBaseWatch(self, path, mask, rec=False, auto_add=False): def addWatch(self, path, mask): if not self.isPathWatched(path): try: - if isbytes(path): - path_obj = pathModule.path(bytes_to_native_str(path)) + if isinstance(path, bytes): + path_obj = pathModule.path(path.decode("utf-8")) else: path_obj = pathModule.path(path) res = pyinotify.WatchManager.add_watch( @@ -277,7 +276,7 @@ def process_default(self, event): # New directory within watch area, # either created, moved in or modfied attributes, ie now readable. - path_name = pathModule.path(bytes_to_native_str(name)) + path_name = pathModule.path(name.decode("utf-8")) if (event.mask == (pyinotify.IN_CREATE | pyinotify.IN_ISDIR) or event.mask == (pyinotify.IN_MOVED_TO | pyinotify.IN_ISDIR) or event.mask == (pyinotify.IN_ATTRIB | pyinotify.IN_ISDIR)): diff --git a/src/fsUtil.py b/src/fsUtil.py index 6eb974f..6645be7 100644 --- a/src/fsUtil.py +++ b/src/fsUtil.py @@ -9,19 +9,18 @@ """ import logging -from future.utils import isbytes, bytes_to_native_str class NativeKeyDict(dict): def __getitem__(self, key): - if isbytes(key): - key = bytes_to_native_str(key) + if isinstance(key, bytes): + key = key.decode("utf-8") return dict.__getitem__(self, key) def __setitem__(self, key, val): - if isbytes(key): - key = bytes_to_native_str(key) + if isinstance(key, bytes): + key = key.decode("utf-8") return dict.__setitem__(self, key, val) From 05daabdc2f72f6dc77a05dadffca1d7b12e04ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Besson?= Date: Tue, 23 Jan 2024 21:13:24 +0000 Subject: [PATCH 04/15] Replace all instances of native_str by str --- src/fsMonitorServer.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/fsMonitorServer.py b/src/fsMonitorServer.py index 9d616e1..0a9e636 100644 --- a/src/fsMonitorServer.py +++ b/src/fsMonitorServer.py @@ -8,7 +8,6 @@ """ from builtins import str -from future.utils import native_str import logging import uuid @@ -256,7 +255,7 @@ def callback(self, monitorId, fileList): try: self.log.info('Event notification on monitor id= %s', monitorId) self.log.debug(' ...notifications are: %s', str(eventList)) - proxy.fsEventHappened(native_str(monitorId), eventList) + proxy.fsEventHappened(str(monitorId), eventList) except Exception as e: self.log.info( 'Callback to monitor id=' + monitorId From 9f7ac2b6ba1c4d197c127c41a3e3ad0ad0a1ab12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Besson?= Date: Tue, 23 Jan 2024 21:14:18 +0000 Subject: [PATCH 05/15] Remove all usages of future.standard_library.install_aliases() --- src/fsDropBoxMonitorClient.py | 2 -- src/fsNotificationScheduler.py | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/fsDropBoxMonitorClient.py b/src/fsDropBoxMonitorClient.py index 4c6a48a..51b24ce 100644 --- a/src/fsDropBoxMonitorClient.py +++ b/src/fsDropBoxMonitorClient.py @@ -8,8 +8,6 @@ """ -from future import standard_library -standard_library.install_aliases() from builtins import str from builtins import range from builtins import object diff --git a/src/fsNotificationScheduler.py b/src/fsNotificationScheduler.py index 2832b60..2d6cc7f 100755 --- a/src/fsNotificationScheduler.py +++ b/src/fsNotificationScheduler.py @@ -7,8 +7,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from future import standard_library -standard_library.install_aliases() from builtins import range import logging import threading From 48ff1da4d911f24751a0f0caa5392831db24587c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Besson?= Date: Tue, 23 Jan 2024 21:19:26 +0000 Subject: [PATCH 06/15] Replace all usages of old_div --- src/fsPyinotifyMonitor.py | 5 ++--- test/drivers.py | 7 +++--- test/unit/test_drivers.py | 45 +++++++++++++++++++-------------------- 3 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/fsPyinotifyMonitor.py b/src/fsPyinotifyMonitor.py index 515def5..6508466 100644 --- a/src/fsPyinotifyMonitor.py +++ b/src/fsPyinotifyMonitor.py @@ -8,7 +8,6 @@ """ from builtins import str -from past.utils import old_div from builtins import object import logging import copy @@ -259,8 +258,8 @@ def process_default(self, event): maskname = event.maskname except Exception: # pyinotify 0.7 or below - name = old_div(pathModule.path(event.path), - pathModule.path(event.name)) + name = (pathModule.path(event.path) / + pathModule.path(event.name)) maskname = event.event_name el = [] diff --git a/test/drivers.py b/test/drivers.py index b40bd36..786da5c 100644 --- a/test/drivers.py +++ b/test/drivers.py @@ -13,7 +13,6 @@ from builtins import str from builtins import range from builtins import object -from past.utils import old_div import logging import threading import time @@ -69,7 +68,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() @@ -160,7 +159,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: @@ -310,7 +309,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]) diff --git a/test/unit/test_drivers.py b/test/unit/test_drivers.py index 2ade17f..7aea682 100644 --- a/test/unit/test_drivers.py +++ b/test/unit/test_drivers.py @@ -12,7 +12,6 @@ from builtins import str from builtins import range -from past.utils import old_div from builtins import object import omero.grid.monitors as monitors import uuid @@ -65,7 +64,7 @@ class TestSimulator(object): def setup_method(self, method): self.uuid = str(uuid.uuid4()) - self.dir = old_div(create_path(folder=True), self.uuid) + self.dir = create_path(folder=True) / self.uuid self.dir.makedirs() self.sim = Simulator(self.dir) self.driver = Driver(self.sim) @@ -79,7 +78,7 @@ def assertErrors(self, count=1): self.driver.errors.pop() def testRelativeTest(self): - assert (old_div(self.dir, "foo")).parpath(self.dir) + assert (self.dir / "foo").parpath(self.dir) assert (self.dir / "foo" / "bar" / "baz").parpath(self.dir) # Not relative assert not (path("/")).parpath(self.dir) @@ -94,78 +93,78 @@ def testBad(self): def testSimpleCreate(self): self.driver.add(InfoEvent(1, monitors.EventInfo( - old_div(self.dir, "foo"), monitors.EventType.Create))) + self.dir / "foo", monitors.EventType.Create))) self.driver.run() def testBadCreate(self): self.driver.add(InfoEvent(1, monitors.EventInfo( - old_div(self.dir, "foo"), monitors.EventType.Create))) + self.dir / "foo", monitors.EventType.Create))) self.driver.add(InfoEvent(1, monitors.EventInfo( - old_div(self.dir, "foo"), monitors.EventType.Create))) + self.dir / "foo", monitors.EventType.Create))) self.driver.run() self.assertErrors() def testBadModify(self): self.driver.add(InfoEvent(1, monitors.EventInfo( - old_div(self.dir, "foo"), monitors.EventType.Modify))) + self.dir / "foo", monitors.EventType.Modify))) self.driver.run() self.assertErrors() def testSimpleModify(self): self.driver.add(InfoEvent(1, monitors.EventInfo( - old_div(self.dir, "foo"), monitors.EventType.Create))) + self.dir / "foo", monitors.EventType.Create))) self.driver.add(InfoEvent(1, monitors.EventInfo( - old_div(self.dir, "foo"), monitors.EventType.Modify))) + self.dir / "foo", monitors.EventType.Modify))) self.driver.run() def testBadDelete(self): self.driver.add(InfoEvent(1, monitors.EventInfo( - old_div(self.dir, "foo"), monitors.EventType.Delete))) + self.dir / "foo", monitors.EventType.Delete))) self.driver.run() self.assertErrors() def testSimpleDelete(self): self.driver.add(InfoEvent(1, monitors.EventInfo( - old_div(self.dir, "foo"), monitors.EventType.Create))) + self.dir / "foo", monitors.EventType.Create))) self.driver.add(InfoEvent(1, monitors.EventInfo( - old_div(self.dir, "foo"), monitors.EventType.Delete))) + self.dir / "foo", monitors.EventType.Delete))) self.driver.run() def testSimpleDeleteWithModify(self): self.driver.add(InfoEvent(1, monitors.EventInfo( - old_div(self.dir, "foo"), monitors.EventType.Create))) + self.dir / "foo", monitors.EventType.Create))) self.driver.add(InfoEvent(1, monitors.EventInfo( - old_div(self.dir, "foo"), monitors.EventType.Modify))) + self.dir / "foo", monitors.EventType.Modify))) self.driver.add(InfoEvent(1, monitors.EventInfo( - old_div(self.dir, "foo"), monitors.EventType.Delete))) + self.dir / "foo", monitors.EventType.Delete))) self.driver.run() def testDirectoryMethodsInfo(self): self.driver.add(InfoEvent(1, monitors.EventInfo( - old_div(self.dir, "foo"), monitors.EventType.Create))) + self.dir / "foo", monitors.EventType.Create))) self.driver.add(InfoEvent(1, monitors.EventInfo( - old_div(self.dir, "foo"), monitors.EventType.Modify))) + self.dir / "foo", monitors.EventType.Modify))) self.driver.add(InfoEvent(1, monitors.EventInfo( - old_div(self.dir, "foo"), monitors.EventType.Delete))) + self.dir / "foo", monitors.EventType.Delete))) self.driver.run() def testDirectoryMethodsDirInfo(self): self.driver.add(DirInfoEvent(1, monitors.EventInfo( - old_div(self.dir, "dir"), monitors.EventType.Create))) + self.dir / "dir", monitors.EventType.Create))) self.driver.add(DirInfoEvent(1, monitors.EventInfo( - old_div(self.dir, "dir"), monitors.EventType.Modify))) + self.dir / "dir", monitors.EventType.Modify))) self.driver.add(DirInfoEvent(1, monitors.EventInfo( - old_div(self.dir, "dir"), monitors.EventType.Delete))) + self.dir / "dir", monitors.EventType.Delete))) self.driver.run() def testDirectoryDoesntExistOnModify(self): self.driver.add(DirInfoEvent(1, monitors.EventInfo( - old_div(self.dir, "dir"), monitors.EventType.Modify))) + self.dir / "dir", monitors.EventType.Modify))) self.driver.run() self.assertErrors() def testDirectoryDoesntExistOnDelete(self): self.driver.add(DirInfoEvent(1, monitors.EventInfo( - old_div(self.dir, "dir"), monitors.EventType.Delete))) + self.dir / "dir", monitors.EventType.Delete))) self.driver.run() self.assertErrors() From b28b510d42384d19e4b3c97d2f6096953daac645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Besson?= Date: Tue, 23 Jan 2024 21:23:22 +0000 Subject: [PATCH 07/15] Remove all unnecessary builtins imports --- src/fsAbstractPlatformMonitor.py | 1 - src/fsDirectory.py | 2 -- src/fsDropBox.py | 2 -- src/fsDropBoxMonitorClient.py | 3 --- src/fsFileServer.py | 1 - src/fsLists.py | 2 -- src/fsMac-10-5-Monitor.py | 3 --- src/fsMonitor.py | 2 -- src/fsMonitorServer.py | 1 - src/fsNotificationScheduler.py | 1 - src/fsPyinotifyMonitor.py | 2 -- src/fsWin-XP-Monitor.py | 2 -- test/conftest.py | 2 -- test/drivers.py | 3 --- test/unit/test_drivers.py | 3 --- test/unit/test_monitor.py | 2 -- test/unit/test_replay.py | 1 - test/unit/test_state.py | 1 - 18 files changed, 34 deletions(-) diff --git a/src/fsAbstractPlatformMonitor.py b/src/fsAbstractPlatformMonitor.py index ea8908c..fcd6f5c 100755 --- a/src/fsAbstractPlatformMonitor.py +++ b/src/fsAbstractPlatformMonitor.py @@ -7,7 +7,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from builtins import str import threading diff --git a/src/fsDirectory.py b/src/fsDirectory.py index e5f30d5..84acb8b 100644 --- a/src/fsDirectory.py +++ b/src/fsDirectory.py @@ -11,8 +11,6 @@ """ -from builtins import str -from builtins import object import logging from time import localtime, strftime diff --git a/src/fsDropBox.py b/src/fsDropBox.py index 7c2e0d7..b3e570b 100644 --- a/src/fsDropBox.py +++ b/src/fsDropBox.py @@ -8,8 +8,6 @@ """ -from builtins import str -from builtins import range import logging log = logging.getLogger("fsclient.DropBox") diff --git a/src/fsDropBoxMonitorClient.py b/src/fsDropBoxMonitorClient.py index 51b24ce..56c9188 100644 --- a/src/fsDropBoxMonitorClient.py +++ b/src/fsDropBoxMonitorClient.py @@ -8,9 +8,6 @@ """ -from builtins import str -from builtins import range -from builtins import object import shlex import logging import threading diff --git a/src/fsFileServer.py b/src/fsFileServer.py index 749eda1..b94feb5 100644 --- a/src/fsFileServer.py +++ b/src/fsFileServer.py @@ -7,7 +7,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from builtins import str import logging try: diff --git a/src/fsLists.py b/src/fsLists.py index 459b553..dc92071 100644 --- a/src/fsLists.py +++ b/src/fsLists.py @@ -14,8 +14,6 @@ """ -from builtins import str -from builtins import object class Greylist(object): """ diff --git a/src/fsMac-10-5-Monitor.py b/src/fsMac-10-5-Monitor.py index 4177cb4..284ded1 100644 --- a/src/fsMac-10-5-Monitor.py +++ b/src/fsMac-10-5-Monitor.py @@ -7,9 +7,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from builtins import str -from builtins import range -from builtins import object import logging import time from Foundation import NSAutoreleasePool, NSMutableArray, NSString diff --git a/src/fsMonitor.py b/src/fsMonitor.py index 9ecd6b3..1c7a753 100644 --- a/src/fsMonitor.py +++ b/src/fsMonitor.py @@ -7,8 +7,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from builtins import str -from builtins import object import logging import threading diff --git a/src/fsMonitorServer.py b/src/fsMonitorServer.py index 0a9e636..09fe190 100644 --- a/src/fsMonitorServer.py +++ b/src/fsMonitorServer.py @@ -7,7 +7,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from builtins import str import logging import uuid diff --git a/src/fsNotificationScheduler.py b/src/fsNotificationScheduler.py index 2d6cc7f..7a12b32 100755 --- a/src/fsNotificationScheduler.py +++ b/src/fsNotificationScheduler.py @@ -7,7 +7,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from builtins import range import logging import threading import queue diff --git a/src/fsPyinotifyMonitor.py b/src/fsPyinotifyMonitor.py index 6508466..78e92a8 100644 --- a/src/fsPyinotifyMonitor.py +++ b/src/fsPyinotifyMonitor.py @@ -7,8 +7,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from builtins import str -from builtins import object import logging import copy import time diff --git a/src/fsWin-XP-Monitor.py b/src/fsWin-XP-Monitor.py index d0c9473..93ecba1 100644 --- a/src/fsWin-XP-Monitor.py +++ b/src/fsWin-XP-Monitor.py @@ -7,8 +7,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from builtins import str -from builtins import object import logging import threading import os diff --git a/test/conftest.py b/test/conftest.py index e244872..f8e393f 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -5,8 +5,6 @@ # how-can-i-repeat-each-test-multiple-times-in-a-py-test-run # -from builtins import range -from builtins import object import os import pytest diff --git a/test/drivers.py b/test/drivers.py index 786da5c..07f25bb 100644 --- a/test/drivers.py +++ b/test/drivers.py @@ -10,9 +10,6 @@ """ -from builtins import str -from builtins import range -from builtins import object import logging import threading import time diff --git a/test/unit/test_drivers.py b/test/unit/test_drivers.py index 7aea682..ee4b0d4 100644 --- a/test/unit/test_drivers.py +++ b/test/unit/test_drivers.py @@ -10,9 +10,6 @@ """ -from builtins import str -from builtins import range -from builtins import object import omero.grid.monitors as monitors import uuid diff --git a/test/unit/test_monitor.py b/test/unit/test_monitor.py index 530a317..7ac616a 100644 --- a/test/unit/test_monitor.py +++ b/test/unit/test_monitor.py @@ -9,8 +9,6 @@ """ -from builtins import str -from builtins import object import pytest import logging import time diff --git a/test/unit/test_replay.py b/test/unit/test_replay.py index dc2aa9f..a2f6279 100644 --- a/test/unit/test_replay.py +++ b/test/unit/test_replay.py @@ -9,7 +9,6 @@ """ -from builtins import object import pytest import logging diff --git a/test/unit/test_state.py b/test/unit/test_state.py index 2df46d5..afdf747 100644 --- a/test/unit/test_state.py +++ b/test/unit/test_state.py @@ -9,7 +9,6 @@ """ -from builtins import object import pytest import logging import time From 80addf68fafc58f4d80f54f608a3f498265f3f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Besson?= Date: Tue, 23 Jan 2024 21:27:01 +0000 Subject: [PATCH 08/15] Remove Python 2 import fallbacks --- src/fsDirectory.py | 6 +----- src/fsDropBox.py | 6 +----- src/fsDropBoxMonitorClient.py | 6 +----- src/fsFileServer.py | 11 ++--------- src/fsMac-10-5-Monitor.py | 6 +----- src/fsPyinotifyMonitor.py | 6 +----- src/fsWin-XP-Monitor.py | 6 +----- test/drivers.py | 6 +----- test/unit/test_drivers.py | 6 +----- test/unit/test_replay.py | 6 +----- 10 files changed, 11 insertions(+), 54 deletions(-) diff --git a/src/fsDirectory.py b/src/fsDirectory.py index 84acb8b..48e857a 100644 --- a/src/fsDirectory.py +++ b/src/fsDirectory.py @@ -17,11 +17,7 @@ # Third party path package. It provides much of the # functionality of os.path but without the complexity. # Imported as pathModule to avoid potential clashes. -try: - from omero_ext import path as pathModule -except ImportError: - # Python 2 - import path as pathModule +from omero_ext import path as pathModule import fsLists diff --git a/src/fsDropBox.py b/src/fsDropBox.py index b3e570b..69424df 100644 --- a/src/fsDropBox.py +++ b/src/fsDropBox.py @@ -21,11 +21,7 @@ # Third party path package. It provides much of the # functionality of os.path but without the complexity. # Imported as pathModule to avoid clashes. -try: - from omero_ext import path as pathModule -except ImportError: - # Python 2 - import path as pathModule +from omero_ext import path as pathModule import omero.all import omero.grid.monitors as monitors diff --git a/src/fsDropBoxMonitorClient.py b/src/fsDropBoxMonitorClient.py index 56c9188..bdf0514 100644 --- a/src/fsDropBoxMonitorClient.py +++ b/src/fsDropBoxMonitorClient.py @@ -13,11 +13,7 @@ import threading import queue import time -try: - from omero_ext import path as pathModule -except ImportError: - # Python 2 - import path as pathModule +from omero_ext import path as pathModule import omero import omero.cli diff --git a/src/fsFileServer.py b/src/fsFileServer.py index b94feb5..b298541 100644 --- a/src/fsFileServer.py +++ b/src/fsFileServer.py @@ -9,19 +9,12 @@ """ import logging -try: - from hashlib import sha1 as sha -except: - from sha import sha +from hashlib import sha1 as sha # Third party path package. It provides much of the # functionality of os.path but without the complexity. # Imported as pathModule to avoid potential clashes. -try: - from omero_ext import path as pathModule -except ImportError: - # Python 2 - import path as pathModule +from omero_ext import path as pathModule import omero.all import omero.grid.monitors as monitors diff --git a/src/fsMac-10-5-Monitor.py b/src/fsMac-10-5-Monitor.py index 284ded1..96aeed9 100644 --- a/src/fsMac-10-5-Monitor.py +++ b/src/fsMac-10-5-Monitor.py @@ -16,11 +16,7 @@ # Third party path package. It provides much of the # functionality of os.path but without the complexity. # Imported as pathModule to avoid potential clashes. -try: - from omero_ext import path as pathModule -except ImportError: - # Python 2 - import path as pathModule +from omero_ext import path as pathModule __import__("omero.all") import omero.grid.monitors as monitors diff --git a/src/fsPyinotifyMonitor.py b/src/fsPyinotifyMonitor.py index 78e92a8..e1ef77e 100644 --- a/src/fsPyinotifyMonitor.py +++ b/src/fsPyinotifyMonitor.py @@ -25,11 +25,7 @@ # Third party path package. It provides much of the # functionality of os.path but without the complexity. # Imported as pathModule to avoid potential clashes. -try: - from omero_ext import path as pathModule -except ImportError: - # Python 2 - import path as pathModule +from omero_ext import path as pathModule class PlatformMonitor(AbstractPlatformMonitor): diff --git a/src/fsWin-XP-Monitor.py b/src/fsWin-XP-Monitor.py index 93ecba1..2ac62a6 100644 --- a/src/fsWin-XP-Monitor.py +++ b/src/fsWin-XP-Monitor.py @@ -15,11 +15,7 @@ # Third party path package. It provides much of the # functionality of os.path but without the complexity. # Imported as pathModule to avoid clashes. -try: - from omero_ext import path as pathModule -except ImportError: - # Python 2 - import path as pathModule +from omero_ext import path as pathModule __import__("omero.all") import omero.grid.monitors as monitors diff --git a/test/drivers.py b/test/drivers.py index 07f25bb..0801776 100644 --- a/test/drivers.py +++ b/test/drivers.py @@ -18,11 +18,7 @@ import omero.all 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 diff --git a/test/unit/test_drivers.py b/test/unit/test_drivers.py index ee4b0d4..28dd0eb 100644 --- a/test/unit/test_drivers.py +++ b/test/unit/test_drivers.py @@ -13,11 +13,7 @@ import omero.grid.monitors as monitors import uuid -try: - from omero_ext.path import path -except ImportError: - # Python 2 - from path import path +from omero_ext.path import path from omero.util.temp_files import create_path from drivers import CallbackEvent, InfoEvent, DirInfoEvent from drivers import MockMonitor, Driver, Simulator diff --git a/test/unit/test_replay.py b/test/unit/test_replay.py index a2f6279..7009ded 100644 --- a/test/unit/test_replay.py +++ b/test/unit/test_replay.py @@ -14,11 +14,7 @@ from drivers import MockMonitor, Replay, with_driver -try: - from omero_ext.path import path -except ImportError: - # Python 2 - from path import path +from omero_ext.path import path logging.basicConfig(level=logging.WARN) From 5eb01178bd3c5384fe406a1e4e6fd950e2b80103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Besson?= Date: Tue, 23 Jan 2024 21:27:22 +0000 Subject: [PATCH 09/15] Remove unmaintained Dockerfile --- Dockerfile | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index b451291..0000000 --- a/Dockerfile +++ /dev/null @@ -1,32 +0,0 @@ -FROM centos:centos7 -RUN localedef -i en_US -f UTF-8 en_US.UTF-8 -ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8' - -RUN yum install -y centos-release-scl \ - && yum install -y rh-python36 \ - && yum install -y python-virtualenv \ - && yum install -y openssl-devel git \ - && virtualenv /py2 && /py2/bin/pip install -U pip tox future wheel restructuredtext-lint -RUN /py2/bin/pip install https://github.com/ome/zeroc-ice-py-manylinux/releases/download/0.1.0/zeroc_ice-3.6.5-cp27-cp27mu-manylinux2010_x86_64.whl -ENV PATH=/opt/rh/rh-python36/root/bin/:$PATH -RUN python -m venv /py3 && /py3/bin/pip install -U pip tox future wheel restructuredtext-lint -RUN /py3/bin/pip install https://github.com/ome/zeroc-ice-py-manylinux/releases/download/0.1.0/zeroc_ice-3.6.5-cp36-cp36m-manylinux2010_x86_64.whl - -ENV VIRTUAL_ENV=/py3 -ENV PATH="$VIRTUAL_ENV/bin:$PATH" - -RUN useradd -ms /bin/bash tox -USER tox - -# Optimize for fixing tests -COPY --chown=tox:tox *.py /src/ -COPY --chown=tox:tox README.rst /src -COPY --chown=tox:tox src /src/src -WORKDIR /src - -# Copy test-related files and run -COPY --chown=tox:tox *.ini /src/ -COPY --chown=tox:tox test /src/test - -ENV PIP_CACHE_DIR=/tmp/pip-cache -ENTRYPOINT ["/py3/bin/tox"] From 24fb0d1d23f21554b8f6790ac461527fbf03253d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Besson?= Date: Wed, 24 Jan 2024 08:37:49 +0000 Subject: [PATCH 10/15] Remove future from tox.ini --- tox.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/tox.ini b/tox.ini index d47b7f5..a08e3a1 100644 --- a/tox.ini +++ b/tox.ini @@ -6,7 +6,6 @@ requires = pip >= 19.0.0 [testenv] deps = - future numpy pytest pytest-mock From cd2291efbca6578ebb84037041771ab7b21c053b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Besson?= Date: Thu, 22 Feb 2024 15:36:21 +0000 Subject: [PATCH 11/15] Add Python 3.12 to the testing matrix --- .github/workflows/tox.yml | 1 + tox.ini | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index d25dee2..f3ab246 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -17,6 +17,7 @@ jobs: - '3.9' - '3.10' - '3.11' + - '3.12' runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 diff --git a/tox.ini b/tox.ini index a08e3a1..59b8068 100644 --- a/tox.ini +++ b/tox.ini @@ -14,6 +14,7 @@ deps = https://github.com/ome/zeroc-ice-py-github-ci/releases/download/0.2.0/zeroc_ice-3.6.5-cp39-cp39-linux_x86_64.whl; platform_system=="Linux" and python_version=="3.9" https://github.com/ome/zeroc-ice-py-github-ci/releases/download/0.2.0/zeroc_ice-3.6.5-cp310-cp310-linux_x86_64.whl; platform_system=="Linux" and python_version=="3.10" https://github.com/glencoesoftware/zeroc-ice-py-linux-x86_64/releases/download/20231024/zeroc_ice-3.6.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; platform_system=="Linux" and python_version=="3.11" + https://github.com/glencoesoftware/zeroc-ice-py-linux-x86_64/releases/download/20240202/zeroc_ice-3.6.5-cp312-cp312-manylinux_2_28_x86_64.whl; platform_system=="Linux" and python_version=="3.12" setenv = ICE_CONFIG = {toxinidir}/ice.config passenv = From 323632c4a9ada0f5209bd5e71fca06e82018d34b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Besson?= Date: Thu, 22 Feb 2024 15:37:49 +0000 Subject: [PATCH 12/15] Require Python 3.8 as the minimum --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 46f7aab..c9ebc24 100755 --- a/setup.py +++ b/setup.py @@ -54,5 +54,5 @@ def read(fname): install_requires=[ "omero-py", # requires Ice (use wheel for faster installs) ], - python_requires='>=3', + python_requires='>=3.8', tests_require=['pytest', 'pytest-mock']) From 8caa8427f919fe3711beb2774ae24188eaf6bfcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Besson?= Date: Thu, 22 Feb 2024 15:38:00 +0000 Subject: [PATCH 13/15] Add setuptools to the dependencies --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 59b8068..0e0cff0 100644 --- a/tox.ini +++ b/tox.ini @@ -10,6 +10,7 @@ deps = pytest pytest-mock restructuredtext-lint + setuptools https://github.com/ome/zeroc-ice-py-github-ci/releases/download/0.2.0/zeroc_ice-3.6.5-cp38-cp38-linux_x86_64.whl; platform_system=="Linux" and python_version=="3.8" https://github.com/ome/zeroc-ice-py-github-ci/releases/download/0.2.0/zeroc_ice-3.6.5-cp39-cp39-linux_x86_64.whl; platform_system=="Linux" and python_version=="3.9" https://github.com/ome/zeroc-ice-py-github-ci/releases/download/0.2.0/zeroc_ice-3.6.5-cp310-cp310-linux_x86_64.whl; platform_system=="Linux" and python_version=="3.10" From c388b0d9ede0607a3d83da9b59fb52134d361e5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Besson?= Date: Thu, 22 Feb 2024 15:40:13 +0000 Subject: [PATCH 14/15] Update GitHub actions to run on Node.js 20 --- .github/workflows/omero_plugin.yml | 2 +- .github/workflows/publish_pypi.yml | 4 ++-- .github/workflows/tox.yml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/omero_plugin.yml b/.github/workflows/omero_plugin.yml index 6ba0f24..4018e16 100644 --- a/.github/workflows/omero_plugin.yml +++ b/.github/workflows/omero_plugin.yml @@ -23,7 +23,7 @@ jobs: env: STAGE: scripts # app, cli, lib, scripts, srv steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Checkout omero-test-infra uses: actions/checkout@master with: diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index 81eccda..e294ba6 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -7,8 +7,8 @@ jobs: name: Build and publish Python distribution to PyPI runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 - name: Build a binary wheel and a source tarball run: | python -mpip install wheel diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index f3ab246..b5dc591 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -20,8 +20,8 @@ jobs: - '3.12' runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies From 9be465b316e0bf0fbbf1b55a89b4dc9d7ecbfab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Besson?= Date: Mon, 18 Mar 2024 17:24:29 +0000 Subject: [PATCH 15/15] Set Python version in the publication workflow --- .github/workflows/publish_pypi.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index e294ba6..3781dfa 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -9,6 +9,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 + with: + python-version: '3.10' - name: Build a binary wheel and a source tarball run: | python -mpip install wheel