Skip to content

Commit

Permalink
Merge pull request #1376 from invisibleroads/patch-3
Browse files Browse the repository at this point in the history
Allow hyphens in project name
  • Loading branch information
mmerickel committed Nov 10, 2014
2 parents af472ad + c1ef71c commit 726bbe8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pyramid/scripts/pcreate.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def render_scaffolds(self):
args = self.args
output_dir = os.path.abspath(os.path.normpath(args[0]))
project_name = os.path.basename(os.path.split(output_dir)[1])
pkg_name = _bad_chars_re.sub('', project_name.lower())
pkg_name = _bad_chars_re.sub(
'', project_name.lower().replace('-', '_'))
safe_name = pkg_resources.safe_name(project_name)
egg_name = pkg_resources.to_filename(safe_name)

Expand Down
17 changes: 17 additions & 0 deletions pyramid/tests/test_scripts/test_pcreate.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,23 @@ def test_known_scaffold_single_rendered(self):
{'project': 'Distro', 'egg': 'Distro', 'package': 'distro',
'pyramid_version': '0.1', 'pyramid_docs_branch':'0.1-branch'})

def test_scaffold_with_hyphen_in_project_name(self):
import os
cmd = self._makeOne('-s', 'dummy', 'Distro-')
scaffold = DummyScaffold('dummy')
cmd.scaffolds = [scaffold]
cmd.pyramid_dist = DummyDist("0.1")
result = cmd.run()
self.assertEqual(result, 0)
self.assertEqual(
scaffold.output_dir,
os.path.normpath(os.path.join(os.getcwd(), 'Distro-'))
)
self.assertEqual(
scaffold.vars,
{'project': 'Distro-', 'egg': 'Distro_', 'package': 'distro_',
'pyramid_version': '0.1', 'pyramid_docs_branch':'0.1-branch'})

def test_known_scaffold_absolute_path(self):
import os
path = os.path.abspath('Distro')
Expand Down

0 comments on commit 726bbe8

Please sign in to comment.