diff --git a/pyramid/scripts/pcreate.py b/pyramid/scripts/pcreate.py index f3121a915c..52f8fea5e3 100644 --- a/pyramid/scripts/pcreate.py +++ b/pyramid/scripts/pcreate.py @@ -22,7 +22,13 @@ def main(argv=sys.argv, quiet=False): class PCreateCommand(object): verbosity = 1 # required - description = "Render Pyramid scaffolding to an output directory" + description = """\ +Render Pyramid scaffolding to an output directory. + +Note: As of Pyramid 1.8, this command is deprecated. Use a specific +cookiecutter instead: +https://github.com/pylons/?query=cookiecutter +""" usage = "usage: %prog [options] -s output_directory" parser = optparse.OptionParser(usage, description=description) parser.add_option('-s', '--scaffold', @@ -77,6 +83,7 @@ def __init__(self, argv, quiet=False): self.scaffolds = self.all_scaffolds() def run(self): + self._warn_pcreate_deprecated() if self.options.list: return self.show_scaffolds() if not self.options.scaffold_name and not self.args: @@ -212,5 +219,12 @@ def confirm_bad_name(self, prompt): # pragma: no cover answer = input_('{0} [y|N]: '.format(prompt)) return answer.strip().lower() == 'y' + def _warn_pcreate_deprecated(self): + self.out('''\ +Note: As of Pyramid 1.8, this command is deprecated. Use a specific +cookiecutter instead: +https://github.com/pylons/?query=cookiecutter +''') + if __name__ == '__main__': # pragma: no cover sys.exit(main() or 0) diff --git a/pyramid/tests/test_scripts/test_pcreate.py b/pyramid/tests/test_scripts/test_pcreate.py index eaa7c1464b..8e6cc2847c 100644 --- a/pyramid/tests/test_scripts/test_pcreate.py +++ b/pyramid/tests/test_scripts/test_pcreate.py @@ -26,7 +26,7 @@ def test_run_show_scaffolds_exist(self): result = cmd.run() self.assertEqual(result, 0) out = self.out_.getvalue() - self.assertTrue(out.startswith('Available scaffolds')) + self.assertTrue(out.count('Available scaffolds')) def test_run_show_scaffolds_none_exist(self): cmd = self._makeOne('-l') @@ -34,7 +34,7 @@ def test_run_show_scaffolds_none_exist(self): result = cmd.run() self.assertEqual(result, 0) out = self.out_.getvalue() - self.assertTrue(out.startswith('No scaffolds available')) + self.assertTrue(out.count('No scaffolds available')) def test_run_no_scaffold_no_args(self): cmd = self._makeOne(quiet=True) @@ -46,7 +46,7 @@ def test_run_no_scaffold_name(self): result = cmd.run() self.assertEqual(result, 2) out = self.out_.getvalue() - self.assertTrue(out.startswith( + self.assertTrue(out.count( 'You must provide at least one scaffold name')) def test_no_project_name(self): @@ -54,14 +54,14 @@ def test_no_project_name(self): result = cmd.run() self.assertEqual(result, 2) out = self.out_.getvalue() - self.assertTrue(out.startswith('You must provide a project name')) + self.assertTrue(out.count('You must provide a project name')) def test_unknown_scaffold_name(self): cmd = self._makeOne('-s', 'dummyXX', 'distro') result = cmd.run() self.assertEqual(result, 2) out = self.out_.getvalue() - self.assertTrue(out.startswith('Unavailable scaffolds')) + self.assertTrue(out.count('Unavailable scaffolds')) def test_known_scaffold_single_rendered(self): import os