Skip to content

Commit 60155c4

Browse files
committed
change code for Python v3
1 parent a21d665 commit 60155c4

File tree

6 files changed

+30
-15
lines changed

6 files changed

+30
-15
lines changed

ronkyuu/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
__download_url__ = 'https://pypi.python.org/pypi/ronkyuu'
1414
__description__ = 'Webmention Manager'
1515

16-
from tools import discoverConfig # noqa
17-
from webmention import findMentions, findEndpoint, discoverEndpoint, sendWebmention # noqa
18-
from relme import findRelMe, confirmRelMe # noqa
19-
from validators import URLValidator # noqa
16+
from .tools import discoverConfig # noqa
17+
from .webmention import findMentions, findEndpoint, discoverEndpoint, sendWebmention # noqa
18+
from .relme import findRelMe, confirmRelMe # noqa
19+
from .validators import URLValidator # noqa

ronkyuu/relme.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66
IndieWeb Rel=Me Tools
77
"""
88

9-
from tools import normalizeURL, cleanURL
9+
from .tools import normalizeURL, cleanURL
1010

1111
import requests
12-
from urlparse import urlparse
1312
from bs4 import BeautifulSoup
1413

14+
try: # Python v3
15+
from urllib.parse import urlparse
16+
except ImportError:
17+
from urlparse import urlparse
18+
1519

1620
_html_parser = 'html5lib' # 'html.parser', 'lxml', 'lxml-xml'
1721

ronkyuu/tools.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
import re
1111
import json
1212
import shlex
13-
from urlparse import urlsplit, urlunsplit
13+
14+
try: # Python v3
15+
from urllib.parse import urlsplit, urlunsplit
16+
except ImportError:
17+
from urlparse import urlsplit, urlunsplit
1418

1519
import requests
1620

ronkyuu/validators.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@
1414
"""
1515

1616
import re
17-
from urlparse import urlsplit, urlunsplit
17+
18+
try: # Python v3
19+
from urllib.parse import urlsplit, urlunsplit
20+
except ImportError:
21+
from urlparse import urlsplit, urlunsplit
22+
1823

1924
class RegexValidator(object):
2025
regex = ''

ronkyuu/webmention.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@
77
"""
88

99
import requests
10-
from urlparse import urlparse, urljoin
1110
from bs4 import BeautifulSoup
12-
13-
from validators import URLValidator
11+
from .validators import URLValidator
1412
from .tools import parse_link_header
1513

14+
try: # Python v3
15+
from urllib.parse import urlparse, urljoin
16+
except ImportError:
17+
from urlparse import urlparse, urljoin
18+
19+
1620
_html_parser = 'html5lib' # 'html.parser', 'lxml', 'lxml-xml'
1721

1822

@@ -73,7 +77,8 @@ def findMentions(sourceURL, targetURL=None, exclude_domains=[], content=None, te
7377
# Allow passing BS doc as content
7478
if isinstance(content, BeautifulSoup):
7579
__doc__ = content
76-
result.update({'content': unicode(__doc__)})
80+
# result.update({'content': unicode(__doc__)})
81+
result.update({'content': str(__doc__)})
7782
else:
7883
__doc__ = BeautifulSoup(content, _html_parser)
7984
result.update({'content': content})

setup.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def extract_metaitem(meta):
3838
license=extract_metaitem('license'),
3939
packages=find_packages(exclude=('tests', 'docs')),
4040
platforms=['Any'],
41-
use_2to3=True,
4241
install_requires=[
4342
'requests',
4443
'beautifulsoup4',
@@ -55,8 +54,6 @@ def extract_metaitem(meta):
5554
'Programming Language :: Python :: 2',
5655
'Programming Language :: Python :: 2.7',
5756
'Programming Language :: Python :: 3',
58-
'Programming Language :: Python :: 3.3',
59-
'Programming Language :: Python :: 3.4',
6057
'Programming Language :: Python :: 3.5',
6158
'Topic :: Software Development :: Libraries :: Python Modules',
6259
]

0 commit comments

Comments
 (0)