File: python3.8.patch

package info (click to toggle)
qiime 2024.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,688 kB
  • sloc: python: 31,045; sh: 96; makefile: 31
file content (36 lines) | stat: -rw-r--r-- 1,214 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Description: patch for compatibility with python 3.8
Author: Étienne Mollier <etienne.mollier@mailoo.org>
Bug: https://github.com/qiime2/qiime2/issues/520
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=950842
Last-Update: 2020-11-30
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/qiime2/core/path.py
+++ b/qiime2/core/path.py
@@ -154,6 +154,14 @@ class InternalDirectory(_ConcretePath):
         # Same reasoning as truediv
         return _ConcretePath(path, str(self))
 
+    def rename(self, path):
+        # We don't want to rename and lose the target right away.
+        # This overrides post python3.8 behavior.
+        _ConcretePath(str(self)).rename(path)
+
+    def replace(self, path):
+        # Same reasoning as replace
+        _ConcretePath(str(self)).replace(path)
 
 class ArchivePath(InternalDirectory):
     DEFAULT_PREFIX = 'qiime2-archive-'
--- a/qiime2/core/type/parse.py
+++ b/qiime2/core/type/parse.py
@@ -93,6 +93,9 @@ def _convert_literals(expr):
     if node is ast.Name and expr.id == 'inf':
         return float('inf')
 
+    if node is ast.Constant:
+        return expr.value
+
     raise ValueError("Unknown literal: %r" % node)