summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2016-12-05 11:34:14 -0600
committerTodd Gamblin <tgamblin@llnl.gov>2016-12-05 09:34:14 -0800
commit161d6205b2dcc61296913701f1b088157fcea118 (patch)
tree6ac1593e3813f4d70e3957b4f082a8b47f093e09 /lib
parent24093a932cbb6369cb8a3f964ea843090fd44869 (diff)
downloadspack-161d6205b2dcc61296913701f1b088157fcea118.tar.gz
spack-161d6205b2dcc61296913701f1b088157fcea118.tar.bz2
spack-161d6205b2dcc61296913701f1b088157fcea118.tar.xz
spack-161d6205b2dcc61296913701f1b088157fcea118.zip
Allow spack create to handle packages with period in name (#2351)
* Allow spack create to handle packages with period in name * Update tests to handle new package name detection scheme
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/create.py1
-rw-r--r--lib/spack/spack/test/url_parse.py18
-rw-r--r--lib/spack/spack/url.py4
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)