Skip to content
Snippets Groups Projects
Commit 5a287084 authored by Robert Speicher's avatar Robert Speicher
Browse files

Merge branch 'python3-support' into 'master'

Python3 support

This branch is based on GitLab-CI support, and should be merged after !1.

We added support for both `python2` and `python3` in the codebase, but it still has python2 hard-coded.

For now we are patching the interpreter used in omnibus to change it to python3 to keep backward compatibility with users using it by source.

In the near future, we will make this switchable with the help of an initializer.

See merge request !2
parents 25b13a63 96207721
No related branches found
No related tags found
1 merge request!2Python3 support
Pipeline #
## 1.4.0 (TO BE RELEASED)
* GitLab CI support
* Fixed `.pod` test files to use newer syntax.
* Changes to support Python 3 (it's not out-of-the box yet, you still need to patch code)
## 1.3.3 (2015-02-17)
 
* Address a slight typo with `POSIX` [#456](https://github.com/github/markup/pull/456)
Loading
Loading
Loading
Loading
@@ -31,9 +31,11 @@ import sys
import os
 
# This fixes docutils failing with unicode parameters to CSV-Table. The -S
# switch and the following 2 lines can be removed after upgrading to python 3.
reload(sys)
sys.setdefaultencoding('utf-8')
# switch and the following 3 lines can be removed after upgrading to python 3.
if sys.version_info[0] < 3:
reload(sys)
sys.setdefaultencoding('utf-8')
import site
 
try:
Loading
Loading
@@ -43,6 +45,7 @@ except:
pass
 
import codecs
import io
 
from docutils import nodes
from docutils.parsers.rst import directives, roles
Loading
Loading
@@ -162,7 +165,11 @@ def main():
except IOError: # given filename could not be found
return ''
except IndexError: # no filename given
text = sys.stdin.read()
if sys.version_info[0] < 3: # python 2.x
text = sys.stdin.read()
else: # python 3
input_stream = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8')
text = input_stream.read()
 
writer = Writer()
writer.translator_class = GitHubHTMLTranslator
Loading
Loading
@@ -185,5 +192,9 @@ def main():
return ''
 
if __name__ == '__main__':
sys.stdout.write("%s%s" % (main(), "\n"))
if sys.version_info[0] < 3: # python 2.x
sys.stdout.write("%s%s" % (main(), "\n"))
else: # python 3
output_stream = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
output_stream.write("%s%s" % (main(), "\n"))
sys.stdout.flush()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment