[Piuparts-devel] [Git][debian/piuparts][develop] use open correctly for python3, thanks deki

Holger Levsen gitlab at salsa.debian.org
Wed Sep 4 22:02:18 BST 2019



Holger Levsen pushed to branch develop at Debian / piuparts


Commits:
223c3acb by Holger Levsen at 2019-09-04T21:02:01Z
use open correctly for python3, thanks deki

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


5 changed files:

- master-bin/detect_well_known_errors.py
- piuparts-analyze.py
- piuparts-master-backend.py
- piuparts-report.py
- piuparts-slave.py


Changes:

=====================================
master-bin/detect_well_known_errors.py
=====================================
@@ -77,7 +77,7 @@ def process_section(section, config, problem_list,
     if not os.access(sectiondir, os.F_OK):
         raise MissingSection("", section)
 
-    with open(os.path.join(sectiondir, "master.lock"), "we") as lock:
+    with open(os.path.join(sectiondir, "master.lock"), "w") as lock:
         try:
             fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
         except IOError:
@@ -163,7 +163,7 @@ caching the problems found, by package, into ".kpr" files.
     conf = WKE_Config()
     conf.read(CONFIG_FILE)
 
-    with open(os.path.join(conf['master-directory'], "dwke.lock"), "we") as lock:
+    with open(os.path.join(conf['master-directory'], "dwke.lock"), "w") as lock:
         try:
             fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
         except IOError:


=====================================
piuparts-analyze.py
=====================================
@@ -325,7 +325,7 @@ def main():
     else:
         sections = conf['sections'].split()
 
-    with open(os.path.join(master_directory, "analyze.lock"), "we") as lock:
+    with open(os.path.join(master_directory, "analyze.lock"), "w") as lock:
         try:
             fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
         except IOError:
@@ -347,7 +347,7 @@ def main():
                 section_directory = os.path.join(master_directory, section_name)
                 if not os.path.exists(section_directory):
                     raise MissingSection("", section_name)
-                with open(os.path.join(section_directory, "master.lock"), "we") as lock:
+                with open(os.path.join(section_directory, "master.lock"), "w") as lock:
                     try:
                         fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
                     except IOError:


=====================================
piuparts-master-backend.py
=====================================
@@ -175,7 +175,7 @@ class Master(Protocol):
         if not os.path.exists(section):
             os.makedirs(section)
 
-        self._lock = open(os.path.join(section, "master.lock"), "we")
+        self._lock = open(os.path.join(section, "master.lock"), "w")
         try:
             fcntl.flock(self._lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
         except IOError:


=====================================
piuparts-report.py
=====================================
@@ -1817,7 +1817,7 @@ def main():
         os.makedirs(master_directory)
         return
 
-    with open(os.path.join(master_directory, "report.lock"), "we") as lock:
+    with open(os.path.join(master_directory, "report.lock"), "w") as lock:
         try:
             fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
         except IOError:
@@ -1840,7 +1840,7 @@ def main():
                 section_directory = os.path.join(master_directory, section_name)
                 if not os.path.exists(section_directory):
                     raise MissingSection("", section_name)
-                with open(os.path.join(section_directory, "master.lock"), "we") as lock:
+                with open(os.path.join(section_directory, "master.lock"), "w") as lock:
                     try:
                         fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
                     except IOError:


=====================================
piuparts-slave.py
=====================================
@@ -554,7 +554,7 @@ class Section:
             self._error_wait_until = time.time() + 3600
             return 0
 
-        with open(os.path.join(self._slave_directory, "slave.lock"), "we") as lock:
+        with open(os.path.join(self._slave_directory, "slave.lock"), "w") as lock:
             oldcwd = os.getcwd()
             os.chdir(self._slave_directory)
             try:
@@ -707,7 +707,7 @@ class Section:
         output_name = log_name(pname, pvers)
         logging.debug("Opening log file %s" % output_name)
         new_name = os.path.join("new", output_name)
-        output = open(new_name, "we")
+        output = open(new_name, "w")
         output.write(time.strftime("Start: %Y-%m-%d %H:%M:%S %Z\n",
                                    time.gmtime()))
 
@@ -947,7 +947,7 @@ def create_chroot(config, tarball, distro):
     command.extend(["--apt", "TARBALL"])  # dummy package name
 
     output_name = tarball + ".log"
-    with open(output_name, "we") as output:
+    with open(output_name, "w") as output:
         try:
             fcntl.flock(output, fcntl.LOCK_EX | fcntl.LOCK_NB)
         except IOError:



View it on GitLab: https://salsa.debian.org/debian/piuparts/commit/223c3acb1344f467376679827ca511c3d46c005b

-- 
View it on GitLab: https://salsa.debian.org/debian/piuparts/commit/223c3acb1344f467376679827ca511c3d46c005b
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/piuparts-devel/attachments/20190904/03a85627/attachment-0001.html>


More information about the Piuparts-devel mailing list