[PATCH] D51220: [clang-tidy] run-clang-tidy fails using python 3.7

2018-09-19 Thread Andi via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL342540: [clang-tidy] run-clang-tidy.py - fails using python 
3.7 (authored by Abpostelnicu, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D51220?vs=166095=166096#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51220

Files:
  clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py


Index: clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
===
--- clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
@@ -167,9 +167,9 @@
 if proc.returncode != 0:
   failed_files.append(name)
 with lock:
-  sys.stdout.write(' '.join(invocation) + '\n' + output + '\n')
-  if err > 0:
-sys.stderr.write(err + '\n')
+  sys.stdout.write(' '.join(invocation) + '\n' + output.decode('utf-8') + 
'\n')
+  if len(err) > 0:
+sys.stderr.write(err.decode('utf-8') + '\n')
 queue.task_done()
 
 


Index: clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
===
--- clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
@@ -167,9 +167,9 @@
 if proc.returncode != 0:
   failed_files.append(name)
 with lock:
-  sys.stdout.write(' '.join(invocation) + '\n' + output + '\n')
-  if err > 0:
-sys.stderr.write(err + '\n')
+  sys.stdout.write(' '.join(invocation) + '\n' + output.decode('utf-8') + '\n')
+  if len(err) > 0:
+sys.stderr.write(err.decode('utf-8') + '\n')
 queue.task_done()
 
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51220: [clang-tidy] run-clang-tidy fails using python 3.7

2018-09-19 Thread Andi via Phabricator via cfe-commits
Abpostelnicu updated this revision to Diff 166095.

https://reviews.llvm.org/D51220

Files:
  clang-tidy/tool/run-clang-tidy.py


Index: clang-tidy/tool/run-clang-tidy.py
===
--- clang-tidy/tool/run-clang-tidy.py
+++ clang-tidy/tool/run-clang-tidy.py
@@ -167,9 +167,9 @@
 if proc.returncode != 0:
   failed_files.append(name)
 with lock:
-  sys.stdout.write(' '.join(invocation) + '\n' + output + '\n')
-  if err > 0:
-sys.stderr.write(err + '\n')
+  sys.stdout.write(' '.join(invocation) + '\n' + output.decode('utf-8') + 
'\n')
+  if len(err) > 0:
+sys.stderr.write(err.decode('utf-8') + '\n')
 queue.task_done()
 
 


Index: clang-tidy/tool/run-clang-tidy.py
===
--- clang-tidy/tool/run-clang-tidy.py
+++ clang-tidy/tool/run-clang-tidy.py
@@ -167,9 +167,9 @@
 if proc.returncode != 0:
   failed_files.append(name)
 with lock:
-  sys.stdout.write(' '.join(invocation) + '\n' + output + '\n')
-  if err > 0:
-sys.stderr.write(err + '\n')
+  sys.stdout.write(' '.join(invocation) + '\n' + output.decode('utf-8') + '\n')
+  if len(err) > 0:
+sys.stderr.write(err.decode('utf-8') + '\n')
 queue.task_done()
 
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51220: [clang-tidy] run-clang-tidy fails using python 3.7

2018-09-10 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment.

Unicode works both with python3 and python2 (but seemed to work before too).

Otherwise LG




Comment at: clang-tidy/tool/run-clang-tidy.py:169
   failed_files.append(name)
-
-if is_py2:

The patch does not apply clean to master because of this part. Could you please 
recheck that?



Comment at: clang-tidy/tool/run-clang-tidy.py:171
+  sys.stdout.write(' '.join(invocation) + '\n' + output.decode('utf-8') + 
'\n')
   if err:
+sys.stderr.write(err.decode('utf-8') + '\n')

please use `len(err)` here instead, python3 does not work.


https://reviews.llvm.org/D51220



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51220: [clang-tidy] run-clang-tidy fails using python 3.7

2018-08-24 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

Have you seen https://reviews.llvm.org/D36624 / https://reviews.llvm.org/D38289 
?
Please test how it behaves with both the python2 and python3 when the 
clang-tidy output contains non-ASCII symbols.


https://reviews.llvm.org/D51220



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51220: [clang-tidy] run-clang-tidy fails using python 3.7

2018-08-24 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment.

LG from my side, but please let @aaron.ballman or @alexfh approve first

Am 24.08.2018 um 18:08 schrieb Andi via Phabricator:

> Abpostelnicu added a comment.
> 
> I can confirm tested on:
>  2.7.15
>  3.7.0
> 
> On both it worked.
> 
> - https://reviews.llvm.org/F7047650: signature.asc 
> https://reviews.llvm.org/F7047650
> 
> https://reviews.llvm.org/D51220


https://reviews.llvm.org/D51220



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51220: [clang-tidy] run-clang-tidy fails using python 3.7

2018-08-24 Thread Andi via Phabricator via cfe-commits
Abpostelnicu added a comment.

I can confirm tested on:
2.7.15
3.7.0

On both it worked.

- F7047650: signature.asc 


https://reviews.llvm.org/D51220



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51220: [clang-tidy] run-clang-tidy fails using python 3.7

2018-08-24 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment.

Could you please verify it is actually working?

Am 24.08.2018 um 18:05 schrieb Andi via Phabricator:

> Abpostelnicu added a comment.
> 
> In https://reviews.llvm.org/D51220#1212463, @JonasToth wrote:
> 
>> I don't know a lot about how to write portable code!
>> 
>> But wouldn't this be out usecase? 
>> http://python-future.org/compatible_idioms.html#file-io-with-open
>> 
>>   Using the `decode` is supposed to work in both pythons
> 
> Yes, indeed, this is more elegant solution!
> 
> https://reviews.llvm.org/D51220


https://reviews.llvm.org/D51220



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51220: [clang-tidy] run-clang-tidy fails using python 3.7

2018-08-24 Thread Andi via Phabricator via cfe-commits
Abpostelnicu added a comment.

In https://reviews.llvm.org/D51220#1212463, @JonasToth wrote:

> I don't know a lot about how to write portable code!
>
> But wouldn't this be out usecase? 
> http://python-future.org/compatible_idioms.html#file-io-with-open
>  Using the `decode` is supposed to work in both pythons


Yes, indeed, this is more elegant solution!


https://reviews.llvm.org/D51220



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51220: [clang-tidy] run-clang-tidy fails using python 3.7

2018-08-24 Thread Andi via Phabricator via cfe-commits
Abpostelnicu updated this revision to Diff 162391.

https://reviews.llvm.org/D51220

Files:
  clang-tidy/tool/run-clang-tidy.py


Index: clang-tidy/tool/run-clang-tidy.py
===
--- clang-tidy/tool/run-clang-tidy.py
+++ clang-tidy/tool/run-clang-tidy.py
@@ -166,18 +166,10 @@
 output, err = proc.communicate()
 if proc.returncode != 0:
   failed_files.append(name)
-
-if is_py2:
-  output_string = output
-  err_string = err
-else:
-  output_string = str(output, 'utf-8')
-  err_string = str(err, 'utf-8')
-
 with lock:
-  sys.stdout.write(' '.join(invocation) + '\n' + output_string + '\n')
+  sys.stdout.write(' '.join(invocation) + '\n' + output.decode('utf-8') + 
'\n')
   if err:
-sys.stderr.write(err_string + '\n')
+sys.stderr.write(err.decode('utf-8') + '\n')
 queue.task_done()
 
 


Index: clang-tidy/tool/run-clang-tidy.py
===
--- clang-tidy/tool/run-clang-tidy.py
+++ clang-tidy/tool/run-clang-tidy.py
@@ -166,18 +166,10 @@
 output, err = proc.communicate()
 if proc.returncode != 0:
   failed_files.append(name)
-
-if is_py2:
-  output_string = output
-  err_string = err
-else:
-  output_string = str(output, 'utf-8')
-  err_string = str(err, 'utf-8')
-
 with lock:
-  sys.stdout.write(' '.join(invocation) + '\n' + output_string + '\n')
+  sys.stdout.write(' '.join(invocation) + '\n' + output.decode('utf-8') + '\n')
   if err:
-sys.stderr.write(err_string + '\n')
+sys.stderr.write(err.decode('utf-8') + '\n')
 queue.task_done()
 
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51220: [clang-tidy] run-clang-tidy fails using python 3.7

2018-08-24 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment.

I don't know a lot about how to write portable code!

But wouldn't this be out usecase? 
http://python-future.org/compatible_idioms.html#file-io-with-open
Using the `decode` is supposed to work in both pythons


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51220



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits