# coding=utf-8
from setuptools import setup, find_packages

NAME = 'django-permission'
VERSION = '0.5.0'

def read(filename, strip=False):
    import os
    import string
    BASE_DIR = os.path.dirname(__file__)
    fi = open(os.path.join(BASE_DIR, filename), 'r')
    bu = fi.readlines()
    if strip:
        bu = [x for x in map(string.strip, bu) if x]
    fi.close()
    return bu

setup(
    name = NAME,
    version = VERSION,
    description = ('A enhanced permission system which enable logical permission'
                   'systems to complex permissions'),
    long_description = "\n".join(read('README.rst')),
    classifiers = (
        'Development Status :: 3 - Alpha',
        'Development Status :: 3 - Alpha',
        'Environment :: Web Environment',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python',
        'Topic :: Internet :: WWW/HTTP',
    ),
    keywords = 'django object logical permission auth authentication',
    author = 'Alisue',
    author_email = 'lambdalisue@hashnote.net',
    url = 'https://github.com/lambdalisue/%s' % NAME,
    download_url = ('https://github.com/lambdalisue/%s/'
                    'tarball/master') % NAME,
    license = 'MIT',
    packages = find_packages('src'),
    package_dir = {'': 'src'},
    include_package_data = True,
    exclude_package_data = {'': 'README.rst'},
    zip_safe=True,
    install_requires=read('requirements.txt', strip=True),
    test_suite='runtests.runtests',
    tests_require=read('requirements-test.txt', strip=True),
)

@@ -120,21 +120,8 @@
 name
-, strip=False
 ):%0A 
@@ -137,26 +137,8 @@
  os%0A
-    import string%0A
     
@@ -184,16 +184,17 @@
   fi
- = open(
+lename = 
 os.p
@@ -225,119 +225,205 @@
 ame)
-, 'r')%0A    bu = fi.readlines()%0A    if strip:%0A        bu = %5Bx for x in map(string.strip, bu) if x%5D%0A    fi.close(
+%0A    with open(filename, 'r') as fi:%0A        return fi.read()%0A%0Adef readlist(filename):%0A    rows = read(filename).split(%22%5Cn%22)%0A    rows = %5Bx.strip() for x in rows%5D%0A    rows = filter(lambda x: x, rows
 )%0A  
@@ -435,10 +435,12 @@
 urn 
-bu
+rows
 %0A%0Ase
@@ -647,18 +647,8 @@
 n = 
-%22%5Cn%22.join(
 read
@@ -661,17 +661,16 @@
 ME.rst')
-)
 ,%0A    cl
@@ -730,51 +730,8 @@
 a',%0A
-        'Development Status :: 3 - Alpha',%0A
     
@@ -1489,24 +1489,28 @@
 equires=read
+list
 ('requiremen
@@ -1516,28 +1516,16 @@
 nts.txt'
-, strip=True
 ),%0A    t
@@ -1577,16 +1577,20 @@
 ire=read
+list
 ('requir
@@ -1609,20 +1609,8 @@
 txt'
-, strip=True
 ),%0A)

Fix Python 3 incompatible setup.py