diff options
author | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2013-07-26 14:04:00 -0700 |
---|---|---|
committer | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2013-07-26 14:04:00 -0700 |
commit | 2f4f9ac7041232e5a74d267706ab6a8c4a982f7f (patch) | |
tree | 6f2d0fbf0eee9eaad7b6a1db69664368938f3fec | |
parent | 2f9d22b2d417b6563cf280e33e1e4688cb2fc4ac (diff) | |
download | pyscss-2f4f9ac7041232e5a74d267706ab6a8c4a982f7f.tar.gz |
Check for relative imports first.
Also fixes a slightly obscure issue where trying to relative-import the
same name a second time from a different directory would be ignored,
because the cache works by name rather than full path.
-rw-r--r-- | scss/__init__.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/scss/__init__.py b/scss/__init__.py index 265a289..31be561 100644 --- a/scss/__init__.py +++ b/scss/__init__.py @@ -768,7 +768,8 @@ class Scss(object): names = block.argument.split(',') for name in names: name = dequote(name.strip()) - if '@import ' + name in rule.options: + import_key = ('@import', name, rule.source_file.parent_dir) + if import_key in rule.options: # If already imported in this scope, skip continue @@ -783,9 +784,9 @@ class Scss(object): i_codestr = None for path in self.search_paths: - for basepath in ['.', rule.source_file.parent_dir]: + for basepath in [rule.source_file.parent_dir, '.']: i_codestr = None - full_path = os.path.realpath(os.path.join(path, basepath, dirname)) + full_path = os.path.realpath(os.path.join(basepath, path, dirname)) if full_path in load_paths: continue try: @@ -842,7 +843,7 @@ class Scss(object): namespace=rule.namespace, ) self.manage_children(_rule, p_children, scope) - rule.options['@import ' + name] = True + rule.options[import_key] = True @print_timing(10) def _do_magic_import(self, rule, p_children, scope, block): |