'federation',
'fba',
'helpers',
- 'locking',
'model',
'network',
'networks',
from fba import commands
from fba import fba
-from fba import locking
+
+from fba.helpers import locking
_PARSER = None
from fba import config
from fba import federation
from fba import fba
-from fba import locking
from fba import network
+from fba.helpers import locking
from fba.helpers import tidyup
from fba.models import blocks
__all__ = [
'cache',
'dicts',
+ 'locking',
'tidyup',
'version',
]
--- /dev/null
+# Fedi API Block - An aggregator for fetching blocking data from fediverse nodes
+# Copyright (C) 2023 Free Software Foundation
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+import os
+import sys
+import tempfile
+import zc.lockfile
+
+# Lock file
+lockfile = tempfile.gettempdir() + '/fba.lock'
+LOCK = None
+
+def acquire():
+ global LOCK
+ # DEBUG: print("DEBUG: CALLED!")
+
+ try:
+ # DEBUG: print(f"DEBUG: Acquiring lock: '{lockfile}'")
+ LOCK = zc.lockfile.LockFile(lockfile)
+ # DEBUG: print("DEBUG: Lock obtained.")
+
+ except zc.lockfile.LockError:
+ print(f"ERROR: Cannot aquire lock: '{lockfile}'")
+ sys.exit(100)
+
+ # DEBUG: print("DEBUG: EXIT!")
+
+def release():
+ # DEBUG: print("DEBUG: CALLED!")
+ if LOCK is not None:
+ # DEBUG: print("DEBUG: Releasing lock ...")
+ LOCK.close()
+ # DEBUG: print(f"DEBUG: Deleting lockfile='{lockfile}' ...")
+ os.remove(lockfile)
+
+ # DEBUG: print("DEBUG: EXIT!")
+++ /dev/null
-# Fedi API Block - An aggregator for fetching blocking data from fediverse nodes
-# Copyright (C) 2023 Free Software Foundation
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published
-# by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <https://www.gnu.org/licenses/>.
-
-import os
-import sys
-import tempfile
-import zc.lockfile
-
-# Lock file
-lockfile = tempfile.gettempdir() + '/fba.lock'
-LOCK = None
-
-def acquire():
- global LOCK
- # DEBUG: print("DEBUG: CALLED!")
-
- try:
- # DEBUG: print(f"DEBUG: Acquiring lock: '{lockfile}'")
- LOCK = zc.lockfile.LockFile(lockfile)
- # DEBUG: print("DEBUG: Lock obtained.")
-
- except zc.lockfile.LockError:
- print(f"ERROR: Cannot aquire lock: '{lockfile}'")
- sys.exit(100)
-
- # DEBUG: print("DEBUG: EXIT!")
-
-def release():
- # DEBUG: print("DEBUG: CALLED!")
- if LOCK is not None:
- # DEBUG: print("DEBUG: Releasing lock ...")
- LOCK.close()
- # DEBUG: print(f"DEBUG: Deleting lockfile='{lockfile}' ...")
- os.remove(lockfile)
-
- # DEBUG: print("DEBUG: EXIT!")