aboutsummaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorPeter Odding <peter@peterodding.com>2014-07-12 02:06:56 +0200
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-09-29 11:44:31 -0500
commit3ae89a59ad6155363fe195852999a9b669e2b395 (patch)
treea521ca1565b8b577480a6bc8d3d308e0ad74d309 /setup.py
parent63ce5df83303380dab8b81a557fa9a8314d3ad5e (diff)
downloadcryptography-3ae89a59ad6155363fe195852999a9b669e2b395.tar.gz
cryptography-3ae89a59ad6155363fe195852999a9b669e2b395.tar.bz2
cryptography-3ae89a59ad6155363fe195852999a9b669e2b395.zip
Replace commands that depend on setup_requires with no-op that raises error
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py49
1 files changed, 48 insertions, 1 deletions
diff --git a/setup.py b/setup.py
index 145854a8..aa915f0c 100644
--- a/setup.py
+++ b/setup.py
@@ -167,7 +167,13 @@ def keywords_with_side_effects(argv):
if len(argv) >= 2 and ('--help' in argv[1:] or
argv[1] in ('--help-commands', '--version',
'clean', 'egg_info')):
- return {}
+ return {
+ "cmdclass": {
+ "build": DummyCFFIBuild,
+ "install": DummyCFFIInstall,
+ "test": DummyPyTest,
+ }
+ }
else:
return {
"setup_requires": requirements,
@@ -179,6 +185,47 @@ def keywords_with_side_effects(argv):
}
+setup_requires_error = ("Requested setup command that needs 'setup_requires' "
+ "while command line arguments implied a side effect "
+ "free command or option.")
+
+
+class DummyCFFIBuild(CFFIBuild):
+ """
+ This class makes it very obvious when ``keywords_with_side_effects()`` has
+ incorrectly interpreted the command line arguments to ``setup.py build`` as
+ one of the 'side effect free' commands or options.
+ """
+
+ def finalize_options(self):
+ raise RuntimeError(setup_requires_error)
+
+
+class DummyCFFIInstall(CFFIInstall):
+ """
+ This class makes it very obvious when ``keywords_with_side_effects()`` has
+ incorrectly interpreted the command line arguments to ``setup.py install``
+ as one of the 'side effect free' commands or options.
+ """
+
+ def finalize_options(self):
+ raise RuntimeError(setup_requires_error)
+
+
+class DummyPyTest(PyTest):
+ """
+ This class makes it very obvious when ``keywords_with_side_effects()`` has
+ incorrectly interpreted the command line arguments to ``setup.py test`` as
+ one of the 'side effect free' commands or options.
+ """
+
+ def finalize_options(self):
+ raise RuntimeError(setup_requires_error)
+
+ def run_tests(self):
+ raise RuntimeError(setup_requires_error)
+
+
with open(os.path.join(base_dir, "README.rst")) as f:
long_description = f.read()