[Piuparts-devel] [Git][debian/piuparts][develop] 3 commits: piupartslib/dependencyparser: mynext() does not take args

Holger Levsen gitlab at salsa.debian.org
Thu Dec 26 15:58:10 GMT 2019



Holger Levsen pushed to branch develop at Debian / piuparts


Commits:
640284d2 by Nis Martensen at 2019-12-26T15:57:47Z
piupartslib/dependencyparser: mynext() does not take args

Arguments were accidentally introduced when porting the code to python3.
Remove them again. Fixes:

  File "/srv/piuparts.debian.org/lib/python3/dist-packages/piupartslib/dependencyparser.py", line 266, in _parse_version_dependency
    self._cursor.mynext(self._cursor)
TypeError: mynext() takes 1 positional argument but 2 were given

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

- - - - -
09916537 by Nis Martensen at 2019-12-26T15:57:51Z
piupartslib/packagesdb: concatenate only lists

While one set of dict_keys() was already wrapped in a list() during the
initial porting work, the second one was still missing. Fixes:

  File "/srv/piuparts.debian.org/lib/python3/dist-packages/piupartslib/packagesdb.py", line 818, in get_best_package_state
    for state in self._good_states + list(self._propagate_waiting_state.keys()) + self._propagate_error_state.keys():
TypeError: can only concatenate list (not "dict_keys") to list

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

- - - - -
8993738a by Nis Martensen at 2019-12-26T15:57:56Z
piupartslib/packagesdb: encode contents for os.write

Fixes:

  File "/srv/piuparts.debian.org/lib/python3/dist-packages/piupartslib/packagesdb.py", line 260, in create
    if os.write(fd, contents) != len(contents):
TypeError: a bytes-like object is required, not 'str'

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

- - - - -


2 changed files:

- piupartslib/dependencyparser.py
- piupartslib/packagesdb.py


Changes:

=====================================
piupartslib/dependencyparser.py
=====================================
@@ -263,7 +263,7 @@ class DependencyParser:
     def _parse_version_dependency(self):
         self._cursor.skip_whitespace()
         if self._cursor.get_char() == "(":
-            self._cursor.mynext(self._cursor)
+            self._cursor.mynext()
 
             self._cursor.skip_whitespace()
             opm = self._cursor.match(self._op_pat)
@@ -285,7 +285,7 @@ class DependencyParser:
             self._cursor.skip_whitespace()
             if self._cursor.get_char() != ")":
                 raise DependencySyntaxError("Expected ')'", self._cursor)
-            self._cursor.mynext(self._cursor)
+            self._cursor.mynext()
 
             return opm.group(), verm.group()
         else:
@@ -296,13 +296,13 @@ class DependencyParser:
     def _parse_arch_restriction(self):
         self._cursor.skip_whitespace()
         if self._cursor.get_char() == "[":
-            self.mynext(self._cursor)
+            self.mynext()
 
             vlist = []
             while True:
                 self._cursor.skip_whitespace()
                 if self._cursor.get_char() == "]":
-                    self._cursor.mynext(self._cursor)
+                    self._cursor.mynext()
                     break
                 m = self._cursor.match(self._arch_pat)
                 if not m:


=====================================
piupartslib/packagesdb.py
=====================================
@@ -257,6 +257,7 @@ class LogDB:
 
     def create(self, subdir, package, version, contents):
         (fd, temp_name) = tempfile.mkstemp(dir=subdir)
+        contents = contents.encode()
         if os.write(fd, contents) != len(contents):
             raise Exception("Partial write?")
         os.close(fd)
@@ -815,7 +816,7 @@ class PackagesDB:
         if not providers:
             return package_state
         states = [self.get_package_state(name, resolve_virtual=False, recurse=recurse) for name in [package_name] + providers]
-        for state in self._good_states + list(self._propagate_waiting_state.keys()) + self._propagate_error_state.keys():
+        for state in self._good_states + list(self._propagate_waiting_state.keys()) + list(self._propagate_error_state.keys()):
             if state in states:
                 return state
         return package_state



View it on GitLab: https://salsa.debian.org/debian/piuparts/compare/fecdaba6f39213553911ad8f544127641b67a531...8993738a2497228508c806a35c93ed928d3e1417

-- 
View it on GitLab: https://salsa.debian.org/debian/piuparts/compare/fecdaba6f39213553911ad8f544127641b67a531...8993738a2497228508c806a35c93ed928d3e1417
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/20191226/2e794ab5/attachment-0001.html>


More information about the Piuparts-devel mailing list