Commit 06b24373 authored by Vincent Pelletier's avatar Vincent Pelletier

Enable Python3 support in setup.py .

parent 4a9737a9
from os.path import join, exists from os.path import join, exists
from setuptools import setup, find_packages from setuptools import setup, find_packages
import hashlib import hashlib
import os
import sys import sys
import urllib extra = {}
if sys.version_info >= (3, ):
extra['use_2to3'] = True
from urllib.request import urlretrieve
else:
from urllib import urlretrieve
FLOT_SHA = 'aefe4e729b2d14efe6e8c0db359cb0e9aa6aae52' FLOT_SHA = 'aefe4e729b2d14efe6e8c0db359cb0e9aa6aae52'
FLOT_AXISLABELS_SHA = '80453cd7fb8a9cad084cf6b581034ada3339dbf8' FLOT_AXISLABELS_SHA = '80453cd7fb8a9cad084cf6b581034ada3339dbf8'
...@@ -38,8 +44,8 @@ _file_dirname = os.path.dirname(__file__) ...@@ -38,8 +44,8 @@ _file_dirname = os.path.dirname(__file__)
def download(url, filename, hexdigest): def download(url, filename, hexdigest):
filename = join(_file_dirname, 'apachedex', filename) filename = join(_file_dirname, 'apachedex', filename)
if not exists(filename): if not exists(filename):
urllib.urlretrieve(url, filename) urlretrieve(url, filename)
if hashlib.md5(open(filename).read()).hexdigest() != hexdigest: if hashlib.md5(open(filename, 'rb').read()).hexdigest() != hexdigest:
raise EnvironmentError('Checksum mismatch downloading %r' % filename) raise EnvironmentError('Checksum mismatch downloading %r' % filename)
for filename, (url, hexdigest) in DEPS.items(): for filename, (url, hexdigest) in DEPS.items():
...@@ -54,7 +60,7 @@ description = open(join(_file_dirname, 'README')).read() ...@@ -54,7 +60,7 @@ description = open(join(_file_dirname, 'README')).read()
setup( setup(
name='APacheDEX', name='APacheDEX',
version='1.3.2', version='1.3.2',
description=(x for x in description.splitlines() if x.strip()).next(), description=next(x for x in description.splitlines() if x.strip()),
long_description=".. contents::\n\n" + description, long_description=".. contents::\n\n" + description,
author='Vincent Pelletier', author='Vincent Pelletier',
author_email='vincent@nexedi.com', author_email='vincent@nexedi.com',
...@@ -66,6 +72,7 @@ setup( ...@@ -66,6 +72,7 @@ setup(
'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)', 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',
'Operating System :: OS Independent', 'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: Implementation :: PyPy', 'Programming Language :: Python :: Implementation :: PyPy',
'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: CPython',
'Topic :: System :: Logging', 'Topic :: System :: Logging',
...@@ -79,7 +86,8 @@ setup( ...@@ -79,7 +86,8 @@ setup(
], ],
}, },
package_data={ package_data={
'apachedex': DEPS.keys() + ['apachedex.js', 'apachedex.css'], 'apachedex': list(DEPS.keys()) + ['apachedex.js', 'apachedex.css'],
}, },
zip_safe=True, zip_safe=True,
**extra
) )
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment