Skip to content
This repository was archived by the owner on Aug 8, 2018. It is now read-only.

Commit 9228f77

Browse files
committed
setup.py cleanup
1 parent 4bc07c0 commit 9228f77

File tree

2 files changed

+33
-23
lines changed

2 files changed

+33
-23
lines changed

HISTORY.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
History
44
-------
55

6-
0.1.0 (20150-1-1)
6+
0.1.0 (2015-01-01)
77
---------------------
88

99
* First release on PyPI.

setup.py

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
3-
4-
3+
import codecs
54
from setuptools import setup
65
from setuptools.command.test import test as TestCommand
76

87

98
class PyTest(TestCommand):
9+
def __init__(self, *args, **kwargs):
10+
super(PyTest, self).__init__(*args, **kwargs)
11+
self.test_suite = True
1012

1113
def finalize_options(self):
1214
TestCommand.finalize_options(self)
1315
self.test_args = []
14-
self.test_suite = True
1516

1617
def run_tests(self):
1718
# import here, cause outside the eggs aren't loaded
@@ -20,22 +21,29 @@ def run_tests(self):
2021
raise SystemExit(errno)
2122

2223

23-
with open('README.rst') as readme_file:
24-
readme = readme_file.read()
24+
with codecs.open('README.rst', encoding='utf8') as readme_file:
25+
README = readme_file.read()
2526

26-
with open('HISTORY.rst') as history_file:
27-
history = history_file.read().replace('.. :changelog:', '')
27+
with codecs.open('HISTORY.rst', encoding='utf8') as history_file:
28+
HISTORY = history_file.read().replace('.. :changelog:', '')
2829

30+
LONG_DESCRIPTION = README + '\n\n' + HISTORY
2931

30-
install_requires = set(x.strip() for x in open('requirements.txt'))
31-
install_requires_replacements = {
32-
'https://github.com/ethereum/ethash/tarball/master#egg=pyethash': 'pyethash'}
32+
INSTALL_REQUIRES_REPLACEMENTS = {
33+
'https://github.com/ethereum/ethash/tarball/master#egg=pyethash': 'pyethash',
34+
}
3335

34-
install_requires = [install_requires_replacements.get(r, r) for r in install_requires]
35-
test_requirements = [
36-
'ethereum-serpent>=1.8.1',
37-
'pytest==2.9.1',
38-
]
36+
INSTALL_REQUIRES = list()
37+
with open('requirements.txt') as requirements_file:
38+
for requirement in requirements_file:
39+
dependency = INSTALL_REQUIRES_REPLACEMENTS.get(
40+
requirement.strip(),
41+
requirement.strip(),
42+
)
43+
44+
INSTALL_REQUIRES.append(dependency)
45+
46+
INSTALL_REQUIRES = list(set(INSTALL_REQUIRES))
3947

4048
# *IMPORTANT*: Don't manually change the version here. Use the 'bumpversion' utility.
4149
# see: https://github.com/ethereum/pyethapp/wiki/Development:-Versions-and-Releases
@@ -44,9 +52,9 @@ def run_tests(self):
4452
setup(
4553
name='pyethapp',
4654
version=version,
47-
description="Python Ethereum Client",
48-
long_description=readme + '\n\n' + history,
49-
author="HeikoHeiko",
55+
description='Python Ethereum Client',
56+
long_description=LONG_DESCRIPTION,
57+
author='HeikoHeiko',
5058
author_email='[email protected]',
5159
url='https://github.com/ethereum/pyethapp',
5260
packages=[
@@ -55,20 +63,22 @@ def run_tests(self):
5563
package_data={
5664
'pyethapp': ['genesisdata/*.json']
5765
},
58-
license="BSD",
66+
license='BSD',
5967
zip_safe=False,
6068
keywords='pyethapp',
6169
classifiers=[
6270
'Development Status :: 2 - Pre-Alpha',
6371
'Intended Audience :: Developers',
6472
'License :: OSI Approved :: BSD License',
6573
'Natural Language :: English',
66-
"Programming Language :: Python :: 2",
74+
'Programming Language :: Python :: 2',
6775
'Programming Language :: Python :: 2.7',
6876
],
6977
cmdclass={'test': PyTest},
70-
install_requires=install_requires,
71-
tests_require=test_requirements,
78+
install_requires=INSTALL_REQUIRES,
79+
tests_require=[
80+
'ethereum-serpent>=1.8.1',
81+
],
7282
entry_points='''
7383
[console_scripts]
7484
pyethapp=pyethapp.app:app

0 commit comments

Comments
 (0)