Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup.py improvements #19

Merged
merged 1 commit into from
Dec 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 30 additions & 23 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,48 +1,55 @@
#!/usr/bin/env python
import sys

from distutils.core import setup
from setuptools import setup
from setuptools.command.bdist_egg import bdist_egg

long_description = """
Context managers for capturing C-level output::

from wurlitzer import pipes

with pipes() as (stdout, stderr):
call_c_function()
out = stdout.read()
err = stderr.read()
"""
with open("README.md") as f:
long_description = f.read()

version_ns = {}
with open('wurlitzer.py') as f:
with open("wurlitzer.py") as f:
for line in f:
if line.startswith('__version__'):
if line.startswith("__version__"):
exec(line, version_ns)


class bdist_egg_disabled(bdist_egg):
"""Disabled version of bdist_egg

Prevents setup.py install from performing setuptools' default easy_install,
which it should never ever do.
"""

def run(self):
sys.exit(
"Aborting implicit building of eggs. Use `pip install .` to install from source."
)


setup_args = dict(
name='wurlitzer',
version=version_ns['__version__'],
name="wurlitzer",
version=version_ns["__version__"],
author="Min RK",
author_email="[email protected]",
description="Capture C-level output in context managers",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/minrk/wurlitzer",
py_modules=['wurlitzer'],
py_modules=["wurlitzer"],
python_requires=">=2.7",
license="MIT",
cmdclass={},
cmdclass={
"bdist_egg": bdist_egg if "bdist_egg" in sys.argv else bdist_egg_disabled
},
classifiers=[
"Development Status :: 3 - Alpha",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
],
)

if 'bdist_wheel' in sys.argv:
from wheel.bdist_wheel import bdist_wheel
setup_args['cmdclass']['bdist_wheel'] = bdist_wheel

if __name__ == '__main__':
if __name__ == "__main__":
setup(**setup_args)