diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3daa3d755b00aff3bafe556c3957a1e196045e35..a2d16d27a6d1511dc3e036e8cfafb4384ce372f3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -185,6 +185,9 @@ Test: - poetry run poe test coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/' stage: test + tags: + - deploy + - swarm ## -------------------------------------------------- # Integration Stage diff --git a/geomagio/Util.py b/geomagio/Util.py index d1cb0a73b1ffc4c164961cddedb8e2b70f973802..69e6659ec7726d0095e43b666907f8ab3d82881f 100644 --- a/geomagio/Util.py +++ b/geomagio/Util.py @@ -4,7 +4,12 @@ from obspy.core import Stats, Trace from obspy import UTCDateTime from io import BytesIO import json -import fcntl +import warnings + +try: + import fcntl +except: + pass class ObjectView(object): @@ -270,6 +275,11 @@ def write_state_file(filename, data, directory=None, encoder=None): fcntl.flock(f, fcntl.LOCK_EX) json.dump(data, f, default=encoder) fcntl.flock(f, fcntl.LOCK_UN) + except NameError as e: + print( + f"The fcntl module is not supported in Windows. Reading/writing state files will not work: {e}" + ) + pass except IOError as e: print(f"Error locking or writing to file: {e}") raise @@ -318,6 +328,10 @@ def read_state_file(filename, directory=None, decoder=None): data = json.load(f, object_hook=decoder) fcntl.flock(f, fcntl.LOCK_UN) return data + except NameError as e: + print( + f"The fcntl module is not supported in Windows. Reading/writing state files will not work: {e}" + ) except IOError as e: print(f"Error locking or reading from file: {e}") raise