Browse Source

fix macos

anonswap
Ofek Lev 6 years ago
parent
commit
3d3c834a91
  1. 18
      setup.py

18
setup.py

@ -22,11 +22,7 @@ except ImportError:
_bdist_wheel = None
pass
try:
from urllib2 import urlopen, URLError
except ImportError:
from urllib.request import urlopen
from urllib.error import URLError
import requests
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
@ -60,9 +56,9 @@ def download_library(command):
if not os.path.exists(libdir):
command.announce('downloading libsecp256k1 source code', level=log.INFO)
try:
r = urlopen(LIB_TARBALL_URL)
if r.getcode() == 200:
content = BytesIO(r.read())
r = requests.get(LIB_TARBALL_URL, stream=True)
if r.status_code == 200:
content = BytesIO(r.raw.read())
content.seek(0)
with tarfile.open(fileobj=content) as tf:
dirname = tf.getnames()[0].partition('/')[0]
@ -73,9 +69,9 @@ def download_library(command):
'Unable to download secp256k1 library: HTTP-Status: %d',
r.getcode()
)
except URLError as ex:
except requests.exceptions.RequestException as e:
raise SystemExit('Unable to download secp256k1 library: %s',
ex.message)
str(e))
class egg_info(_egg_info):
@ -250,7 +246,7 @@ else:
def has_c_libraries(self):
return not has_system_lib()
setup_kwargs = dict(
setup_requires=['cffi>=1.3.0'],
setup_requires=['cffi>=1.3.0', 'requests'],
ext_package='coincurve',
cffi_modules=['_cffi_build/build.py:ffi'],
cmdclass={

Loading…
Cancel
Save