old_contents: #!/usr/bin/env python
  # -*- coding: utf-8 -*-
  
  
  try:
      from setuptools import setup
  except ImportError:
      from distutils.core import setup
  
  
  with open('README.rst') as readme_file:
      readme = readme_file.read()
  
  with open('HISTORY.rst') as history_file:
      history = history_file.read().replace('.. :changelog:', '')
  
  requirements = [
      'six==1.9.0'
  ]
  
  setup(
      name='patchy',
      version='1.0.0',
      description="Patch functions live",
      long_description=readme + '\n\n' + history,
      author="Adam Johnson",
      author_email='me@adamj.eu',
      url='https://github.com/adamchainz/patchy',
      packages=[
          'patchy',
      ],
      package_dir={'patchy':
                   'patchy'},
      include_package_data=True,
      install_requires=requirements,
      license="BSD",
      zip_safe=False,
      keywords='patchy',
      classifiers=[
          'Development Status :: 2 - Pre-Alpha',
          'Intended Audience :: Developers',
          'License :: OSI Approved :: BSD License',
          'Natural Language :: English',
          "Programming Language :: Python :: 2",
          'Programming Language :: Python :: 2.6',
          'Programming Language :: Python :: 2.7',
          'Programming Language :: Python :: 3',
          'Programming Language :: Python :: 3.3',
          'Programming Language :: Python :: 3.4',
      ],
  )
  
new_contents: #!/usr/bin/env python
  # -*- coding: utf-8 -*-
  import os
  import re
  import sys
  
  try:
      from setuptools import setup
  except ImportError:
      from distutils.core import setup
  
  
  def get_version(package):
      """
      Return package version as listed in `__version__` in `init.py`.
      """
      init_py = open(os.path.join(package, '__init__.py')).read()
      return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
  
  
  def get_packages(package):
      """
      Return root package and all sub-packages.
      """
      return [dirpath
              for dirpath, dirnames, filenames in os.walk(package)
              if os.path.exists(os.path.join(dirpath, '__init__.py'))]
  
  
  version = get_version('patchy')
  
  
  if sys.argv[-1] == 'publish':
      if os.system("pip freeze | grep wheel"):
          print("wheel not installed.\nUse `pip install wheel`.\nExiting.")
          sys.exit()
      if os.system("pip freeze | grep twine"):
          print("twine not installed.\nUse `pip install twine`.\nExiting.")
          sys.exit()
      os.system("python setup.py sdist bdist_wheel")
      os.system("twine upload dist/*")
      print("You probably want to also tag the version now:")
      print("  git tag -a %s -m 'version %s'" % (version, version))
      print("  git push --tags")
      sys.exit()
  
  
  with open('README.rst') as readme_file:
      readme = readme_file.read()
  
  with open('HISTORY.rst') as history_file:
      history = history_file.read().replace('.. :changelog:', '')
  
  
  requirements = [
      'six==1.9.0'
  ]
  
  setup(
      name='patchy',
      version=version,
      description="Patch the source of python functions at runtime.",
      long_description=readme + '\n\n' + history,
      author="Adam Johnson",
      author_email='me@adamj.eu',
      url='https://github.com/adamchainz/patchy',
      packages=get_packages('patchy'),
      include_package_data=True,
      install_requires=requirements,
      license="BSD",
      zip_safe=False,
      keywords='patchy',
      classifiers=[
          'Development Status :: Development Status :: 5 - Production/Stable',
          'Intended Audience :: Developers',
          'License :: OSI Approved :: BSD License',
          'Natural Language :: English',
          'Operating System :: OS Independent',
          "Programming Language :: Python :: 2",
          'Programming Language :: Python :: 2.7',
          'Programming Language :: Python :: 3',
          'Programming Language :: Python :: 3.4',
      ],
  )
  
subject: Copy setup.py utils