Remove ambiguous python shebangs

This commit is contained in:
Tom Stellard 2018-09-19 16:03:58 +00:00
parent 5d6c3ad71b
commit fe1772d561
2 changed files with 110 additions and 2 deletions

View File

@ -0,0 +1,93 @@
From c760f8d703af0c67774681b5a259d5dd3a1e5a77 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Wed, 19 Sep 2018 08:53:10 -0700
Subject: [PATCH] Convert scan-view to python3 using 2to3
---
tools/scan-view/bin/scan-view | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/tools/scan-view/bin/scan-view b/tools/scan-view/bin/scan-view
index 1b6e8ba..ca3dac5 100755
--- a/tools/scan-view/bin/scan-view
+++ b/tools/scan-view/bin/scan-view
@@ -7,9 +7,9 @@ import sys
import imp
import os
import posixpath
-import thread
+import _thread
import time
-import urllib
+import urllib.request, urllib.parse, urllib.error
import webbrowser
# How long to wait for server to start.
@@ -27,7 +27,7 @@ kMaxPortsToTry = 100
def url_is_up(url):
try:
- o = urllib.urlopen(url)
+ o = urllib.request.urlopen(url)
except IOError:
return False
o.close()
@@ -35,7 +35,7 @@ def url_is_up(url):
def start_browser(port, options):
- import urllib
+ import urllib.request, urllib.parse, urllib.error
import webbrowser
url = 'http://%s:%d' % (options.host, port)
@@ -52,10 +52,10 @@ def start_browser(port, options):
sys.stderr.flush()
time.sleep(kSleepTimeout)
else:
- print >> sys.stderr, 'WARNING: Unable to detect that server started.'
+ print('WARNING: Unable to detect that server started.', file=sys.stderr)
if options.debug:
- print >> sys.stderr, '%s: Starting webbrowser...' % sys.argv[0]
+ print('%s: Starting webbrowser...' % sys.argv[0], file=sys.stderr)
webbrowser.open(url)
@@ -69,9 +69,9 @@ def run(port, options, root):
import ScanView
try:
- print 'Starting scan-view at: http://%s:%d' % (options.host,
- port)
- print ' Use Ctrl-C to exit.'
+ print('Starting scan-view at: http://%s:%d' % (options.host,
+ port))
+ print(' Use Ctrl-C to exit.')
httpd = ScanView.create_server((options.host, port),
options, root)
httpd.serve_forever()
@@ -80,9 +80,9 @@ def run(port, options, root):
def port_is_open(port):
- import SocketServer
+ import socketserver
try:
- t = SocketServer.TCPServer((kDefaultHost, port), None)
+ t = socketserver.TCPServer((kDefaultHost, port), None)
except:
return False
t.server_close()
@@ -135,7 +135,7 @@ def main():
# Kick off thread to wait for server and start web browser, if
# requested.
if args.startBrowser:
- t = thread.start_new_thread(start_browser, (port, args))
+ t = _thread.start_new_thread(start_browser, (port, args))
run(port, args, args.root)
--
1.8.3.1

View File

@ -59,7 +59,7 @@
Name: %pkg_name
Version: %{maj_ver}.%{min_ver}.%{patch_ver}
Release: 0.14.rc%{rc_ver}%{?dist}
Release: 0.15.rc%{rc_ver}%{?dist}
Summary: A C language family front-end for LLVM
License: NCSA
@ -85,6 +85,7 @@ Patch2: 0001-Driver-Prefer-vendor-supplied-gcc-toolchain.patch
Patch4: 0001-gtest-reorg.patch
Patch5: 0001-Don-t-prefer-python2.7.patch
Patch6: 0001-Convert-clang-format-diff.py-to-python3-using-2to3.patch
Patch7: 0001-Convert-scan-view-to-python3-using-2to3.patch
BuildRequires: gcc
BuildRequires: gcc-c++
@ -229,6 +230,15 @@ suite can be run with any compiler, not just clang.
%setup -T -q -b 2 -n %{test_suite_srcdir}
pathfix.py -i %{__python2} -pn \
ParseMultipleResults \
utils/*.py \
CollectDebugInfoUsingLLDB.py \
CompareDebugInfo.py \
tools/get-report-time \
FindMissingLineNo.py \
MicroBenchmarks/libs/benchmark-1.3.0/tools/compare_bench.py
%setup -q -n %{clang_srcdir}
%patch0 -p1 -b .lit-search-path
%patch1 -p1 -b .fstack-clash-protection
@ -236,12 +246,14 @@ suite can be run with any compiler, not just clang.
%patch4 -p1 -b .gtest
%patch5 -p1 -b .no-python2
%patch6 -p1 -b .clang-format-diff-py3
%patch7 -p1 -b .scan-view-py3
mv ../%{clang_tools_srcdir} tools/extra
pathfix.py -i %{__python3} -pn \
tools/clang-format/*.py \
utils/hmaptool/hmaptool
utils/hmaptool/hmaptool \
tools/scan-view/bin/scan-view
%endif
%build
@ -436,6 +448,9 @@ false
%endif
%changelog
* Wed Sep 19 2018 Tom Stellard <tstellar@redhat.com> - 7.0.0-0.15.rc3
- Remove ambiguous python shebangs
* Thu Sep 13 2018 Tom Stellard <tstellar@redhat.com> - 7.0.0-0.14.rc3
- Move unversioned shared objects to devel package