Skip to content

Instantly share code, notes, and snippets.

@dholth
Last active June 3, 2016 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dholth/59e4c8a0c0d963b019d81e18bf0a89e3 to your computer and use it in GitHub Desktop.
Save dholth/59e4c8a0c0d963b019d81e18bf0a89e3 to your computer and use it in GitHub Desktop.
Write setuptools' setup_requires and tests_require to a file in egg_info. As is always the case with setuptools, it still installs setup_requires as a side effect.
def requires_writer(cmd, basename, filename):
cmd.write_file("setup_requires", filename,
str(cmd.distribution.setup_requires) + '\n' +
str(cmd.distribution.tests_require) + '\n')
from setuptools import setup
setup(name='acmd',
version='1.0',
description="Write setup_requires.txt to egg_info",
py_modules = ['acmd'],
setup_requires = ['pip', 'wheel', 'setuptools'],
tests_require = ['simplejson'],
zip_safe=False,
entry_points={
"egg_info.writers": [
"setup_requires.txt = acmd:requires_writer"
]
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment