File: python3b.patch

package info (click to toggle)
watchman 4.9.0-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,992 kB
  • sloc: cpp: 27,459; python: 6,538; java: 3,404; php: 3,257; ansic: 2,803; javascript: 1,116; makefile: 671; ruby: 364; sh: 124; xml: 102; lisp: 4
file content (47 lines) | stat: -rw-r--r-- 1,369 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
37
38
39
40
41
42
43
44
45
46
47
From: Wez Furlong <wez@fb.com>
Date: Wed, 15 Aug 2018 12:40:15 -0700
Subject: fixup py2 vs py3 compat issue with watchman-make

Summary:
Copied and pasted our logic from WatchmanTestCase.py

Fixes: https://github.com/facebook/watchman/issues/631

Reviewed By: chadaustin

Differential Revision: D9330044

fbshipit-source-id: 3d19013d65fee640a6b209f6acc766e24d68c6b5
(cherry picked from commit e48f0298e888817c6cc1ee27876b34358428de2a)

Origin: upstream, v2020.05.11.00
---
 python/bin/watchman-make | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/python/bin/watchman-make b/python/bin/watchman-make
index 8fc3329..9422850 100755
--- a/python/bin/watchman-make
+++ b/python/bin/watchman-make
@@ -7,6 +7,12 @@ import sys
 import subprocess
 
 
+if pywatchman.compat.PYTHON3:
+    STRING_TYPES = (str, bytes)
+else:
+    STRING_TYPES = (str, unicode)  # noqa: F821
+
+
 def patterns_to_terms(pats):
     # convert a list of globs into the equivalent watchman expression term
     if pats is None or len(pats) == 0:
@@ -100,7 +106,7 @@ class DefineTarget(argparse.Action):
             targets = []
             setattr(namespace, self.dest, targets)
 
-        if isinstance(values, basestring):
+        if isinstance(values, STRING_TYPES):
             values = [values]
 
         if namespace.pattern is None or len(namespace.pattern) == 0: