Skip to content
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
2 changes: 1 addition & 1 deletion discount/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import ctypes

import libmarkdown
from discount import libmarkdown


_KWARGS_TO_LIBMARKDOWN_FLAGS = {
Expand Down
9 changes: 4 additions & 5 deletions discount/libmarkdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import ctypes
import os

import sys

MKD_NOLINKS = 0x0001
MKD_NOIMAGE = 0x0002
Expand Down Expand Up @@ -55,10 +55,9 @@
class FILE(ctypes.Structure):
pass


ctypes.pythonapi.PyFile_AsFile.argtypes = (ctypes.py_object,)

ctypes.pythonapi.PyFile_AsFile.restype = ctypes.POINTER(FILE)
if sys.version_info[0] == 2:
ctypes.pythonapi.PyFile_AsFile.argtypes = (ctypes.py_object,)
ctypes.pythonapi.PyFile_AsFile.restype = ctypes.POINTER(FILE)


class Cstring(ctypes.Structure):
Expand Down
12 changes: 9 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
from __future__ import absolute_import, print_function

import os
import posixpath
import shutil
import subprocess
import urllib2

try:
import urllib2
except ImportError:
import urllib.request as urllib2

from distutils.command.build_ext import build_ext as _build_ext
from distutils.core import setup, Extension
Expand Down Expand Up @@ -71,14 +77,14 @@ def build_extension(self, ext):
os.makedirs(self.build_temp)

if not os.path.exists(filepath):
print 'Downloading %s...' % self.discount_download_url
print('Downloading %s...' % self.discount_download_url)

data = urllib2.urlopen(self.discount_download_url)
fp = open(filepath, 'wb')
fp.write(data.read())
fp.close()

print 'Extracting %s...' % filepath
print('Extracting %s...' % filepath)

subprocess.call(
['tar', 'xzf', filepath, '-C', self.build_temp]
Expand Down