old_contents: #!/usr/bin/env python
  from setuptools import setup, find_packages
  
  
  __version__ = "0.1rc5"
  
  requirements_file = "requirements.txt"
  requirements = [pkg.strip() for pkg in open(requirements_file).readlines()]
  requirements_test_file = "requirements_test.txt"
  requirements_tests = [pkg.strip() for pkg in open(requirements_file).readlines()]
  
  try:
      import pypandoc
      long_description = pypandoc.convert('README.md', 'rst') + "\n"
  except(IOError, ImportError):
      long_description = open('README.md').read() + "\n"
  
  setup(
      name='passpie',
      version=__version__,
      license='License :: OSI Approved :: MIT License',
      description="Manage your login credentials from the terminal painlessly.",
      long_description=long_description,
      author='Marcwebbie',
      author_email='marcwebbie@gmail.com',
      url='https://github.com/marcwebbie/passpie',
      download_url='https://pypi.python.org/pypi/passpie',
      packages=find_packages(),
      entry_points="""
          [console_scripts]
          passpie=passpie.cli:cli
      """,
      install_requires=requirements,
      tests_require=requirements_tests,
      test_suite='tests',
      classifiers=[
          'Development Status :: 4 - Beta',
          'Environment :: Console',
          'Intended Audience :: End Users/Desktop',
          'License :: OSI Approved :: MIT License',
          'Natural Language :: English',
          'Operating System :: OS Independent',
          'Programming Language :: Python :: 2.7',
          'Programming Language :: Python :: 3',
          'Programming Language :: Python :: 3.3',
          'Programming Language :: Python :: 3.4',
          'Programming Language :: Python :: Implementation :: CPython',
          'Programming Language :: Python :: Implementation :: PyPy',
          'Programming Language :: Python',
          'Topic :: Security :: Cryptography',
      ],
  )
  
new_contents: #!/usr/bin/env python
  
  import os
  import sys
  
  try:
      from setuptools import setup, Command, find_packages
  except ImportError:
      from distutils.core import setup, Command, find_packages
  
  
  __version__ = "0.1rc5"
  
  
  if sys.argv[-1] == 'publish':
      os.system('python setup.py sdist upload')
      os.system('python setup.py bdist_wheel upload')
      sys.exit()
  
  
  if sys.argv[-1] == 'tag':
      os.system("git tag -a %s -m 'version %s'" % (__version__, __version__))
      os.system("git push --tags")
      sys.exit()
  
  
  requirements_file = "requirements.txt"
  requirements = [pkg.strip() for pkg in open(requirements_file).readlines()]
  requirements_test_file = "requirements_test.txt"
  requirements_tests = [pkg.strip() for pkg in open(requirements_file).readlines()]
  
  try:
      import pypandoc
      long_description = pypandoc.convert('README.md', 'rst') + "\n"
  except(IOError, ImportError):
      long_description = open('README.md').read() + "\n"
  
  
  class PyTest(Command):
      user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
  
      def initialize_options(self):
          self.pytest_args = []
  
      def finalize_options(self):
          pass
  
      def run(self):
          import pytest
          errno = pytest.main(self.pytest_args)
          sys.exit(errno)
  
  
  setup(
      name='passpie',
      version=__version__,
      license='License :: OSI Approved :: MIT License',
      description="Manage your login credentials from the terminal painlessly.",
      long_description=long_description,
      author='Marcwebbie',
      author_email='marcwebbie@gmail.com',
      url='https://github.com/marcwebbie/passpie',
      download_url='https://pypi.python.org/pypi/passpie',
      packages=find_packages(),
      entry_points="""
          [console_scripts]
          passpie=passpie.cli:cli
      """,
      install_requires=requirements,
      cmdclass={'test': PyTest},
      tests_require=requirements_tests,
      test_suite='tests',
      classifiers=[
          'Development Status :: 4 - Beta',
          'Environment :: Console',
          'Intended Audience :: End Users/Desktop',
          'License :: OSI Approved :: MIT License',
          'Natural Language :: English',
          'Operating System :: OS Independent',
          'Programming Language :: Python :: 2.7',
          'Programming Language :: Python :: 3',
          'Programming Language :: Python :: 3.3',
          'Programming Language :: Python :: 3.4',
          'Programming Language :: Python :: Implementation :: CPython',
          'Programming Language :: Python :: Implementation :: PyPy',
          'Programming Language :: Python',
          'Topic :: Security :: Cryptography',
      ],
  )
  
subject: Refactor setup.py adding py.test tags and publish tasks