#!/usr/bin/env python
# coding: utf-8

from setuptools import setup
import os
import re

root_dir = os.path.abspath(os.path.dirname(__file__))


def get_version(package_name):
    version_re = re.compile(r"^__version__ = [\"']([\w_.-]+)[\"']$")
    package_components = package_name.split('.')
    path_components = package_components + ['__init__.py']
    with open(os.path.join(root_dir, *path_components)) as f:
        for line in f:
            match = version_re.match(line[:-1])
            if match:
                return match.groups()[0]
    return '0.1.0'


PACKAGE = 'restricted_pkg'


setup(
    name="restricted_pkg",
    version=get_version(PACKAGE),
    author="Raphaël Barrois",
    author_email="raphael.barrois@polytechnique.org",
    description="A simple setup.py helper for private repositories",
    license="MIT",
    keywords=['pypi', 'package index', 'private', 'repository'],
    url="http://github.com/rbarrois/restricted_pkg",
    download_url="http://pypi.python.org/pypi/restricted_pkg/",
    packages=[
        'restricted_pkg',
    ],
    setup_requires=[
        'setuptools>=0.8', 
    ],
    classifiers=[
        "Development Status :: 5 - Production/Stable",
        "Intended Audience :: Developers",
        "License :: OSI Approved :: MIT License",
        "Topic :: Software Development :: Libraries :: Python Modules",
        "Operating System :: OS Independent",
        "Programming Language :: Python",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 2",
    ],
    test_suite='tests',
    entry_points={
        'distutils.setup_keywords': [
            'private_repository = restricted_pkg.validators:validate_private_repo',
        ],
    },
)

@@ -16,16 +16,20 @@
 python%0A#
+ -*-
  coding:
@@ -38,46 +38,55 @@
 tf-8
-%0A%0Afrom setuptools 
+ -*-%0A%0Aimport codecs%0Aimport os%0A
 import 
-setup
+re
 %0Aimport 
 os%0Ai
@@ -81,28 +81,49 @@
 %0Aimport 
-os%0A
+sys%0A%0Afrom setuptools 
 import 
-re
+setup
 %0A%0Aroot_d
@@ -329,26 +329,45 @@
     
-path_components = 
+init_path = os.path.join(root_dir, *(
 pack
@@ -398,16 +398,18 @@
 t__.py'%5D
+))
 %0A    wit
@@ -414,53 +414,43 @@
 ith 
-open(os.path.join(root_dir, *path_components)
+codecs.open(init_path, 'r', 'utf-8'
 ) as
@@ -1154,17 +1154,16 @@
 s%3E=0.8',
- 
 %0A    %5D,%0A

Fix setup.py for Python3.