text: #!/usr/bin/env python
  
  from __future__ import print_function
  
  import json
  import os
  import subprocess
  import sys
  
  from setuptools import setup, find_packages
  from codecs import open
  
  from mezzanine_events import __version__
  
  # Get the long description from the README file
  with open("README.rst", encoding="utf-8") as f:
      long_description = f.read()
  
  # Bump version and generate CHANGELOG
  if sys.argv[:2] == ["setup.py", "bump"]:
      try:
          subprocess.check_call("bump2version %s" % sys.argv[2])
      except IndexError:
          print("Please provide a version type: patch, minor, major")
  
      with open("package.json", "r") as f:
          new_version = json.load(f)["version"]
      subprocess.check_call("conventional-changelog -p angular -i CHANGELOG.md -s", shell=True)
      subprocess.check_call('git commit -am "chore: bump version to %s"' % new_version)
      subprocess.check_call("git tag v%s" % new_version)
      sys.exit()
  
  # Tag and release the package to PyPI
  if sys.argv[:2] == ["setup.py", "release"]:
      subprocess.check_call("git push")
      subprocess.check_call("git push --tags")
      subprocess.check_call("rm -rf dist/")
      subprocess.check_call("python setup.py sdist")
      subprocess.check_call("python setup.py bdist_wheel")
      subprocess.check_call("twine upload dist/*")
      sys.exit()
  
  setup(
      name="mezzanine-events",
      version=__version__,
      description="Calendar events for Mezzanine CMS",
      long_description=long_description,
      url="https://github.com/unplugstudio/mezzanine-events",
      author="Unplug Studio",
      author_email="hello@unplug.studio",
      license="MIT",
      classifiers=[
          "Development Status :: 5 - Production/Stable",
          "Intended Audience :: Developers",
          "Topic :: Software Development :: Libraries",
          "License :: OSI Approved :: MIT License",
          "Programming Language :: Python :: 2",
          "Programming Language :: Python :: 2.7",
          "Programming Language :: Python :: 3",
          "Programming Language :: Python :: 3.6",
      ],
      keywords="django mezzanine",
      packages=find_packages(),
      install_requires=["django>=1.7", "django-eventtools>=0.9,<1.0"],
      include_package_data=True,
  )
  