diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/cmd/create.py | 1 | ||||
-rw-r--r-- | lib/spack/spack/test/url_parse.py | 18 | ||||
-rw-r--r-- | lib/spack/spack/url.py | 4 |
3 files changed, 13 insertions, 10 deletions
diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py index f22fa14602..79825264e6 100644 --- a/lib/spack/spack/cmd/create.py +++ b/lib/spack/spack/cmd/create.py @@ -434,7 +434,6 @@ def create(parser, args): # Figure out a name and repo for the package. name, version = guess_name_and_version(url, args) spec = Spec(name) - name = spec.name.lower() # factors out namespace, if any repo = find_repository(spec, args) tty.msg("This looks like a URL for %s version %s" % (name, version)) diff --git a/lib/spack/spack/test/url_parse.py b/lib/spack/spack/test/url_parse.py index 6c944a3e7a..368532038f 100644 --- a/lib/spack/spack/test/url_parse.py +++ b/lib/spack/spack/test/url_parse.py @@ -59,10 +59,10 @@ class UrlParseTest(unittest.TestCase): def test_version_sourceforge_download(self): self.check( - 'foo_bar', '1.21', + 'foo-bar', '1.21', 'http://sourceforge.net/foo_bar-1.21.tar.gz/download') self.check( - 'foo_bar', '1.21', + 'foo-bar', '1.21', 'http://sf.net/foo_bar-1.21.tar.gz/download') def test_no_version(self): @@ -71,7 +71,7 @@ class UrlParseTest(unittest.TestCase): def test_version_all_dots(self): self.check( - 'foo.bar.la', '1.14', 'http://example.com/foo.bar.la.1.14.zip') + 'foo-bar-la', '1.14', 'http://example.com/foo.bar.la.1.14.zip') def test_version_underscore_separator(self): self.check( @@ -136,12 +136,12 @@ class UrlParseTest(unittest.TestCase): def test_version_single_digit(self): self.check( - 'foo_bar', '45', + 'foo-bar', '45', 'http://example.com/foo_bar.45.tar.gz') def test_noseparator_single_digit(self): self.check( - 'foo_bar', '45', + 'foo-bar', '45', 'http://example.com/foo_bar45.tar.gz') def test_version_developer_that_hates_us_format(self): @@ -151,7 +151,7 @@ class UrlParseTest(unittest.TestCase): def test_version_regular(self): self.check( - 'foo_bar', '1.21', + 'foo-bar', '1.21', 'http://example.com/foo_bar-1.21.tar.gz') def test_version_github(self): @@ -216,7 +216,7 @@ class UrlParseTest(unittest.TestCase): def test_imagemagick_style(self): self.check( - 'ImageMagick', '6.7.5-7', + 'imagemagick', '6.7.5-7', 'http://downloads.sf.net/project/machomebrew/mirror/ImageMagick-6.7.5-7.tar.bz2') @@ -247,7 +247,7 @@ class UrlParseTest(unittest.TestCase): def test_xaw3d_version(self): self.check( - 'Xaw3d', '1.5E', + 'xaw3d', '1.5E', 'ftp://ftp.visi.com/users/hawkeyd/X/Xaw3d-1.5E.tar.gz') def test_fann_version(self): @@ -324,5 +324,5 @@ class UrlParseTest(unittest.TestCase): def test_github_raw_url(self): self.check( - 'PowerParser', '2.0.7', + 'powerparser', '2.0.7', 'https://github.com/losalamos/CLAMR/blob/packages/PowerParser_v2.0.7.tgz?raw=true') diff --git a/lib/spack/spack/url.py b/lib/spack/spack/url.py index 8842495613..117f8488ee 100644 --- a/lib/spack/spack/url.py +++ b/lib/spack/spack/url.py @@ -305,6 +305,10 @@ def parse_name_offset(path, v=None): if match_string is stem: start += offset + # package names should be lowercase and separated by dashes. + name = name.lower() + name = re.sub('[_.]', '-', name) + return name, start, len(name) raise UndetectableNameError(path) |