jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/400457 )

Change subject: Run Pygments using Python 3
......................................................................


Run Pygments using Python 3

Python 2 is dying, <https://pythonclock.org/>, it's time to move on.

The create_pygmentize_bundle script now requires Python 3 to run, and will
generate a bundle with a python3 shebang. Technically the bundle is still
compatible with Python 2 as long as the shebang is modified.

Bug: T182851
Change-Id: Ifb9d0abf092e2c08d9a638a7dda3bda0bc808789
---
M pygments/create_pygmentize_bundle
M pygments/pygmentize
2 files changed, 9 insertions(+), 13 deletions(-)

Approvals:
  Ladsgroup: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pygments/create_pygmentize_bundle 
b/pygments/create_pygmentize_bundle
index c6366a2..d69fa69 100755
--- a/pygments/create_pygmentize_bundle
+++ b/pygments/create_pygmentize_bundle
@@ -1,26 +1,22 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 """
   Create a standalone, executable 'pygmentize' bundle.
   Author: Ori Livneh
 
 """
-import sys
-reload(sys)
-sys.setdefaultencoding('utf-8')
-
 import hashlib
 import io
 import os
 import stat
 import textwrap
-import urllib2
-import xmlrpclib
+import urllib.request
+import xmlrpc.client
 import zipfile
 
 
-PYGMENTIZE_LAUNCHER = textwrap.dedent(b'''\
-  #!/usr/bin/env python
+PYGMENTIZE_LAUNCHER = textwrap.dedent('''\
+  #!/usr/bin/env python3
 
   import sys
   import pygments.cmdline
@@ -32,7 +28,7 @@
 
 
 print('Querying PyPI for the latest Pygments release...')
-pypi = xmlrpclib.ServerProxy('https://pypi.python.org/pypi')
+pypi = xmlrpc.client.ServerProxy('https://pypi.python.org/pypi')
 latest_version = pypi.package_releases('Pygments')[0]
 for release in pypi.release_urls('Pygments', latest_version):
     if (release['packagetype'] == 'bdist_wheel' and
@@ -44,7 +40,7 @@
         raise RuntimeError('No suitable package found.')
 
 print('Retrieving version %s (%s)...' % (latest_version, url))
-req = urllib2.urlopen(url)
+req = urllib.request.urlopen(url)
 buf = io.BytesIO(req.read())
 
 print('Verifying...')
@@ -58,8 +54,8 @@
 data = buf.getvalue()
 script_dir = os.path.dirname(os.path.abspath(__file__))
 file_path = os.path.join(script_dir, 'pygmentize')
-with open(file_path, 'w') as f:
-    f.write('#!/usr/bin/env python\n')
+with open(file_path, 'wb') as f:
+    f.write(b'#!/usr/bin/env python3\n')
     f.write(data)
 
 file_st = os.stat(file_path)
diff --git a/pygments/pygmentize b/pygments/pygmentize
index 8b1e9da..b02e4c7 100755
--- a/pygments/pygmentize
+++ b/pygments/pygmentize
Binary files differ

-- 
To view, visit https://gerrit.wikimedia.org/r/400457
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifb9d0abf092e2c08d9a638a7dda3bda0bc808789
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SyntaxHighlight_GeSHi
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: TheDJ <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to