Skip to content

Commit 03b6145

Browse files
committed
Modernize the setup.py
- Use io.open() instead of codecs.open() - Drop the unused unichr() definition for Python 3 - Add zip_safe = True (although I hate zipped eggs) - Add keywords - Reindent setup() parameters
1 parent 84d8a81 commit 03b6145

1 file changed

Lines changed: 33 additions & 38 deletions

File tree

setup.py

Lines changed: 33 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
11
#!/usr/bin/python
2-
import codecs
32
import doctest
3+
import io
44
import os
55
import re
66
import sys
77
import unittest
88

99
from setuptools import setup
1010

11-
try:
12-
unichr
13-
except NameError:
14-
# Python 3.x support
15-
unichr = chr
16-
1711

1812
def read(filename):
19-
f = codecs.open(filename, 'r', 'utf-8')
20-
try:
13+
with io.open(filename, encoding='UTF-8') as f:
2114
return f.read()
22-
finally:
23-
f.close()
2415

2516

2617
def unsphinx(text):
@@ -67,30 +58,34 @@ def build_images(doctests=()):
6758
sys.exit(0)
6859

6960

70-
setup(name='objgraph',
71-
version=get_version(),
72-
author='Marius Gedminas',
73-
author_email='marius@gedmin.as',
74-
url='https://mg.pov.lt/objgraph/',
75-
license='MIT',
76-
description='Draws Python object reference graphs with graphviz',
77-
long_description=get_description(),
78-
classifiers=[
79-
'Intended Audience :: Developers',
80-
'License :: OSI Approved :: MIT License',
81-
'Operating System :: OS Independent',
82-
'Programming Language :: Python',
83-
'Programming Language :: Python :: 2',
84-
'Programming Language :: Python :: 2.7',
85-
'Programming Language :: Python :: 3',
86-
'Programming Language :: Python :: 3.3',
87-
'Programming Language :: Python :: 3.4',
88-
'Programming Language :: Python :: 3.5',
89-
'Programming Language :: Python :: 3.6',
90-
],
91-
py_modules=['objgraph'],
92-
install_requires=[
93-
'graphviz', # just for ipython support currently
94-
],
95-
tests_require=['mock'],
96-
test_suite='tests.test_suite')
61+
setup(
62+
name='objgraph',
63+
version=get_version(),
64+
author='Marius Gedminas',
65+
author_email='marius@gedmin.as',
66+
url='https://mg.pov.lt/objgraph/',
67+
license='MIT',
68+
description='Draws Python object reference graphs with graphviz',
69+
long_description=get_description(),
70+
classifiers=[
71+
'Intended Audience :: Developers',
72+
'License :: OSI Approved :: MIT License',
73+
'Operating System :: OS Independent',
74+
'Programming Language :: Python',
75+
'Programming Language :: Python :: 2',
76+
'Programming Language :: Python :: 2.7',
77+
'Programming Language :: Python :: 3',
78+
'Programming Language :: Python :: 3.3',
79+
'Programming Language :: Python :: 3.4',
80+
'Programming Language :: Python :: 3.5',
81+
'Programming Language :: Python :: 3.6',
82+
],
83+
keywords='object graph visualization graphviz garbage collection',
84+
py_modules=['objgraph'],
85+
install_requires=[
86+
'graphviz', # just for ipython support currently
87+
],
88+
tests_require=['mock'],
89+
test_suite='tests.test_suite',
90+
zip_safe=True,
91+
)

0 commit comments

Comments
 (0)