Skip to content

Convert to Python3 #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
sudo: true
language: python

python:
- 2.6
- 2.7
- "2.7"
- "3.6"
- "3.7-dev" # 3.7 development branch

install:
- pip install -r requirements_dev.txt --use-mirrors
- python setup.py install
- pip install -r requirements.txt

script: python setup.py test
script :
- python setup.py install
# - python setup.py test
10 changes: 5 additions & 5 deletions bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
$Id$
"""

import os, shutil, sys, tempfile, urllib2
import os, shutil, sys, tempfile, urllib.request, urllib.error, urllib.parse

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats python3 only

Copy link
Author

@ralic ralic May 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add following script shall make it python2/3 compatible

# Python 2 and 3: alternative 4
try:
    from urllib.parse import urlparse, urlencode
    from urllib.request import urlopen, Request
    from urllib.error import HTTPError
except ImportError:
    from urlparse import urlparse
    from urllib import urlencode
    from urllib2 import urlopen, Request, HTTPError

from optparse import OptionParser

tmpeggs = tempfile.mkdtemp()
Expand Down Expand Up @@ -62,12 +62,12 @@
except ImportError:
ez = {}
if USE_DISTRIBUTE:
exec urllib2.urlopen('http://python-distribute.org/distribute_setup.py'
).read() in ez
exec(urllib.request.urlopen('http://python-distribute.org/distribute_setup.py'
).read(), ez)
ez['use_setuptools'](to_dir=tmpeggs, download_delay=0, no_fake=True)
else:
exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
).read() in ez
exec(urllib.request.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
).read(), ez)
ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)

if to_reload:
Expand Down
8 changes: 4 additions & 4 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
source_suffix = '.rst'
master_doc = 'index'

project = u'restkit'
copyright = u'2008-2013 Benoît Chesneau <[email protected]>'
project = 'restkit'
copyright = '2008-2013 Benoît Chesneau <[email protected]>'

version = restkit.__version__
release = version
Expand All @@ -43,6 +43,6 @@
htmlhelp_basename = 'restkitdoc'

latex_documents = [
('index', 'restkit.tex', u'restkit Documentation',
u'Benoît Chesneau', 'manual'),
('index', 'restkit.tex', 'restkit Documentation',
'Benoît Chesneau', 'manual'),
]
Loading