[damned-lies] Updated dir-related code
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Updated dir-related code
- Date: Sat, 26 May 2018 10:57:01 +0000 (UTC)
commit 513008eed40168b7d160ef5b5e9289e7a09cf9b5
Author: Claude Paroz <claude 2xlibre net>
Date: Sat May 26 12:40:17 2018 +0200
Updated dir-related code
stats/models.py | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index fcfa1f3b..28736868 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -156,15 +156,15 @@ class ModuleLock(object):
def __init__(self, mod):
assert isinstance(mod, Module)
self.module = mod
- self.dirpath = os.path.join("/tmp", "updating-%s" % (self.module.name,))
+ self.dirpath = os.path.join("/tmp", "updating-%s" % self.module.name)
def __enter__(self):
while True:
try:
os.mkdir(self.dirpath)
- break;
- except OSError:
- # The directory exists, something is happening on the module, let's wait
+ break
+ except FileExistsError:
+ # Something is happening on the module, let's wait
sleep(10)
def __exit__(self, *exc_info):
@@ -570,9 +570,7 @@ class Branch(models.Model):
modulepath = self.co_path
scmroot = self.module.vcs_root
- try: os.makedirs(localroot)
- except: pass
-
+ os.makedirs(localroot, exist_ok=True)
command_list = []
if self._exists():
command_list.extend(self.update_repo(execute=False))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]