summaryrefslogtreecommitdiff
path: root/extensions/SyntaxHighlight_GeSHi/pygments
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/SyntaxHighlight_GeSHi/pygments')
-rw-r--r--extensions/SyntaxHighlight_GeSHi/pygments/PYGMENTS_LICENSE25
-rw-r--r--extensions/SyntaxHighlight_GeSHi/pygments/create_pygmentize_bundle68
-rw-r--r--extensions/SyntaxHighlight_GeSHi/pygments/pygmentizebin0 -> 673141 bytes
3 files changed, 93 insertions, 0 deletions
diff --git a/extensions/SyntaxHighlight_GeSHi/pygments/PYGMENTS_LICENSE b/extensions/SyntaxHighlight_GeSHi/pygments/PYGMENTS_LICENSE
new file mode 100644
index 00000000..f24578fd
--- /dev/null
+++ b/extensions/SyntaxHighlight_GeSHi/pygments/PYGMENTS_LICENSE
@@ -0,0 +1,25 @@
+Copyright (c) 2006-2015 by the respective authors (see AUTHORS file).
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file
diff --git a/extensions/SyntaxHighlight_GeSHi/pygments/create_pygmentize_bundle b/extensions/SyntaxHighlight_GeSHi/pygments/create_pygmentize_bundle
new file mode 100644
index 00000000..9f638b9c
--- /dev/null
+++ b/extensions/SyntaxHighlight_GeSHi/pygments/create_pygmentize_bundle
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+# -*- 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 zipfile
+
+
+PYGMENTIZE_LAUNCHER = textwrap.dedent(b'''\
+ #!/usr/bin/env python
+
+ import sys
+ import pygments.cmdline
+ try:
+ sys.exit(pygments.cmdline.main(sys.argv))
+ except KeyboardInterrupt:
+ sys.exit(1)
+''')
+
+
+print('Querying PyPI for the latest Pygments release...')
+pypi = xmlrpclib.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
+ release['python_version'].startswith('2')):
+ url = release['url']
+ md5_digest = release['md5_digest']
+ break
+ else:
+ raise RuntimeError('No suitable package found.')
+
+print('Retreiving version %s (%s)...' % (latest_version, url))
+req = urllib2.urlopen(url)
+buf = io.BytesIO(req.read())
+
+print('Verifying...')
+if hashlib.md5(buf.getvalue()).hexdigest() != md5_digest:
+ raise RuntimeError('MD5 checksum mismatch.')
+
+print('Creating executable ZIP bundle...')
+with zipfile.ZipFile(buf, 'a') as zf:
+ zf.writestr('__main__.py', PYGMENTIZE_LAUNCHER)
+
+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')
+ f.write(data)
+
+file_st = os.stat(file_path)
+os.chmod(file_path, file_st.st_mode | stat.S_IEXEC)
+
+print('Done. Wrote %s bytes to %s' % (len(data), file_path))
diff --git a/extensions/SyntaxHighlight_GeSHi/pygments/pygmentize b/extensions/SyntaxHighlight_GeSHi/pygments/pygmentize
new file mode 100644
index 00000000..3cc23e45
--- /dev/null
+++ b/extensions/SyntaxHighlight_GeSHi/pygments/pygmentize
Binary files differ