diff --git a/libsass b/libsass index 31521ef3..62314f6a 160000 --- a/libsass +++ b/libsass @@ -1 +1 @@ -Subproject commit 31521ef3ece636892f395a80392448ceae449b90 +Subproject commit 62314f6a3cbc7dbed3878884504847edd7fecb7b diff --git a/pysass.cpp b/pysass.cpp index 01dda201..3dfc364c 100644 --- a/pysass.cpp +++ b/pysass.cpp @@ -417,7 +417,7 @@ PySass_compile_string(PyObject *self, PyObject *args) { struct Sass_Context *ctx; struct Sass_Data_Context *context; struct Sass_Options *options; - char *string, *include_paths, *image_path; + char *string, *include_paths; const char *error_message, *output_string; Sass_Output_Style output_style; int source_comments, error_status, precision; @@ -425,19 +425,18 @@ PySass_compile_string(PyObject *self, PyObject *args) { PyObject *result; if (!PyArg_ParseTuple(args, - PySass_IF_PY3("yiiyyiO", "siissiO"), + PySass_IF_PY3("yiiyiO", "siisiO"), &string, &output_style, &source_comments, - &include_paths, &image_path, &precision, + &include_paths, &precision, &custom_functions)) { return NULL; } - context = sass_make_data_context(string); + context = sass_make_data_context(strdup(string)); options = sass_data_context_get_options(context); sass_option_set_output_style(options, output_style); sass_option_set_source_comments(options, source_comments); sass_option_set_include_path(options, include_paths); - sass_option_set_image_path(options, image_path); sass_option_set_precision(options, precision); _add_custom_functions(options, custom_functions); @@ -461,16 +460,16 @@ PySass_compile_filename(PyObject *self, PyObject *args) { struct Sass_Context *ctx; struct Sass_File_Context *context; struct Sass_Options *options; - char *filename, *include_paths, *image_path; + char *filename, *include_paths; const char *error_message, *output_string, *source_map_string; Sass_Output_Style output_style; int source_comments, error_status, precision; PyObject *source_map_filename, *custom_functions, *result; if (!PyArg_ParseTuple(args, - PySass_IF_PY3("yiiyyiOO", "siissiOO"), + PySass_IF_PY3("yiiyiOO", "siisiOO"), &filename, &output_style, &source_comments, - &include_paths, &image_path, &precision, + &include_paths, &precision, &source_map_filename, &custom_functions)) { return NULL; } @@ -493,7 +492,6 @@ PySass_compile_filename(PyObject *self, PyObject *args) { sass_option_set_output_style(options, output_style); sass_option_set_source_comments(options, source_comments); sass_option_set_include_path(options, include_paths); - sass_option_set_image_path(options, image_path); sass_option_set_precision(options, precision); _add_custom_functions(options, custom_functions); diff --git a/sass.py b/sass.py index ee2f067c..cd4619f9 100644 --- a/sass.py +++ b/sass.py @@ -144,7 +144,7 @@ def __str__(self): def compile_dirname( search_path, output_path, output_style, source_comments, include_paths, - image_path, precision, custom_functions, + precision, custom_functions, ): fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding() for dirpath, _, filenames in os.walk(search_path): @@ -159,7 +159,7 @@ def compile_dirname( input_filename = input_filename.encode(fs_encoding) s, v, _ = compile_filename( input_filename, output_style, source_comments, include_paths, - image_path, precision, None, custom_functions, + precision, None, custom_functions, ) if s: v = v.decode('UTF-8') @@ -192,8 +192,6 @@ def compile(**kwargs): :param include_paths: an optional list of paths to find ``@import``\ ed SASS/CSS source files :type include_paths: :class:`collections.Sequence`, :class:`str` - :param image_path: an optional path to find images - :type image_path: :class:`str` :param precision: optional precision for numbers. :const:`5` by default. :type precision: :class:`int` :param custom_functions: optional mapping of custom functions. @@ -229,8 +227,6 @@ def compile(**kwargs): :param include_paths: an optional list of paths to find ``@import``\ ed SASS/CSS source files :type include_paths: :class:`collections.Sequence`, :class:`str` - :param image_path: an optional path to find images - :type image_path: :class:`str` :param precision: optional precision for numbers. :const:`5` by default. :type precision: :class:`int` :param custom_functions: optional mapping of custom functions. @@ -269,8 +265,6 @@ def compile(**kwargs): :param include_paths: an optional list of paths to find ``@import``\ ed SASS/CSS source files :type include_paths: :class:`collections.Sequence`, :class:`str` - :param image_path: an optional path to find images - :type image_path: :class:`str` :param precision: optional precision for numbers. :const:`5` by default. :type precision: :class:`int` :param custom_functions: optional mapping of custom functions. @@ -424,16 +418,6 @@ def func_name(a, b): 'Windows) string, not ' + repr(include_paths)) if isinstance(include_paths, text_type): include_paths = include_paths.encode(fs_encoding) - try: - image_path = kwargs.pop('image_path') - except KeyError: - image_path = b'.' - else: - if not isinstance(image_path, string_types): - raise TypeError('image_path must be a string, not ' + - repr(image_path)) - elif isinstance(image_path, text_type): - image_path = image_path.encode(fs_encoding) custom_functions = kwargs.pop('custom_functions', ()) if isinstance(custom_functions, collections.Mapping): @@ -460,10 +444,10 @@ def func_name(a, b): string = kwargs.pop('string') if isinstance(string, text_type): string = string.encode('utf-8') - s, v = compile_string(string, - output_style, source_comments, - include_paths, image_path, precision, - custom_functions) + s, v = compile_string( + string, output_style, source_comments, include_paths, precision, + custom_functions, + ) if s: return v.decode('utf-8') elif 'filename' in modes: @@ -475,10 +459,8 @@ def func_name(a, b): elif isinstance(filename, text_type): filename = filename.encode(fs_encoding) s, v, source_map = compile_filename( - filename, - output_style, source_comments, - include_paths, image_path, precision, source_map_filename, - custom_functions, + filename, output_style, source_comments, include_paths, precision, + source_map_filename, custom_functions, ) if s: v = v.decode('utf-8') @@ -522,10 +504,8 @@ def func_name(a, b): raise ValueError('dirname must be a pair of (source_dir, ' 'output_dir)') s, v = compile_dirname( - search_path, output_path, - output_style, source_comments, - include_paths, image_path, precision, - custom_functions, + search_path, output_path, output_style, source_comments, + include_paths, precision, custom_functions, ) if s: return diff --git a/sassc.py b/sassc.py index 1bfd7774..85bf9b54 100755 --- a/sassc.py +++ b/sassc.py @@ -21,10 +21,6 @@ Optional directory path to find ``@import``\ ed (S)CSS files. Can be multiply used. -.. option:: -i , --image-path - - Path to find images. Default is the current directory (:file:`./`). - .. option:: -m, -g, --sourcemap Emit source map. Requires the second argument (output CSS filename). @@ -88,8 +84,6 @@ def main(argv=sys.argv, stdout=sys.stdout, stderr=sys.stderr): dest='include_paths', action='append', help='Path to find "@import"ed (S)CSS source files. ' 'Can be multiply used.') - parser.add_option('-i', '--image-path', metavar='DIR', default='./', - help='Path to find images. [default: %default]') parser.add_option('-w', '--watch', action='store_true', help='Watch file for changes. Requires the second ' 'argument (output css filename).') @@ -130,7 +124,6 @@ def main(argv=sys.argv, stdout=sys.stdout, stderr=sys.stderr): output_style=options.output_style, source_map_filename=source_map_filename, include_paths=options.include_paths, - image_path=options.image_path, precision=options.precision ) else: @@ -140,7 +133,6 @@ def main(argv=sys.argv, stdout=sys.stdout, stderr=sys.stderr): filename=filename, output_style=options.output_style, include_paths=options.include_paths, - image_path=options.image_path, precision=options.precision ) except (IOError, OSError) as e: diff --git a/sasstests.py b/sasstests.py index a24bd097..aed141bc 100644 --- a/sasstests.py +++ b/sasstests.py @@ -57,7 +57,7 @@ def normalize_path(path): 'sources': ['test/a.scss'], 'sourcesContent': [], 'names': [], - 'mappings': ';AAKA;EAHE,AAAkB;;EAKpB,AAAK;IACD,AAAO', + 'mappings': ';AAKA,IAAI,CAAC;EAHH,gBAAgB,EAAE,KAAM,GAGpB;;EAEJ,IAAI,CAAC,CAAC,CAAJ;IACA,KAAK,EAAE,IAAK,GADX', } B_EXPECTED_CSS = '''\ @@ -221,12 +221,6 @@ def test_compile_invalid_source_comments(self): string='a { color: blue; }', source_comments='invalid') - def test_compile_invalid_image_path(self): - self.assertRaises(TypeError, sass.compile, - string='a { color: blue; }', image_path=[]) - self.assertRaises(TypeError, sass.compile, - string='a { color: blue; }', image_path=123) - def test_compile_string(self): actual = sass.compile(string='a { b { color: blue; } }') assert actual == 'a b {\n color: blue; }\n' @@ -247,7 +241,8 @@ def test_compile_string(self): a { color: blue; } -/* 유니코드 */''', +/* 유니코드 */ +''', actual ) self.assertRaises(sass.CompileError, sass.compile, @@ -409,7 +404,7 @@ def test_output_style(self): self.assertEqual('a.scss.css', result_files['a.scss']) with open(os.path.join(css_path, 'a.scss.css'), **utf8_if_py3) as f: css = f.read() - self.assertEqual('body{background-color:green}body a{color:blue}', + self.assertEqual('body{background-color:green}body a{color:blue}\n', css) @@ -462,7 +457,7 @@ def test_build_one(self): 'sources': ['../test/b.scss'], 'sourcesContent': [], 'names': [], - 'mappings': ';AACA,AAAE;EACE,AAAW', + 'mappings': ';AACE,CAAC,CAAC,CAAC,CAAD;EACA,SAAS,EAAE,IAAI,GADd', }, os.path.join(d, 'css', 'b.scss.css.map') ) @@ -480,7 +475,7 @@ def test_build_one(self): 'sources': ['../test/d.scss'], 'sourcesContent': [], 'names': [], - 'mappings': ';AAKA;EAHE,AAAkB;;EAKpB,AAAK;IACD,AAAM', + 'mappings': ';;AAKA,IAAI,CAAC;EAHH,gBAAgB,EAAE,KAAM,GAGpB;;EAEJ,IAAI,CAAC,CAAC,CAAJ;IACA,IAAI,EAAE,0BAA2B,GADhC', }, os.path.join(d, 'css', 'd.scss.css.map') ) @@ -561,7 +556,7 @@ def test_build_sass(self): ) with open(self.css_path('a.scss.css')) as f: self.assertEqual( - 'p a {\n color: red; }\np b {\n color: blue; }\n', + 'p a {\n color: red; }\n\np b {\n color: blue; }\n', f.read() ) @@ -570,7 +565,7 @@ def test_output_style(self): self.assertEqual(0, rv) with open(self.css_path('a.scss.css')) as f: self.assertEqual( - 'p a{color:red}p b{color:blue}', + 'p a{color:red}p b{color:blue}\n', f.read() ) @@ -727,8 +722,8 @@ def test_error(self): assert False, 'Expected to raise' except sass.CompileError as e: msg, = e.args - assert msg.decode('UTF-8').endswith( - 'bad.scss:1: invalid property name\n' + assert msg.decode('UTF-8').startswith( + 'Error: invalid property name' ), msg return except Exception as e: @@ -1007,111 +1002,112 @@ class CustomFunctionsTest(unittest.TestCase): def test_raises(self): with assert_raises_compile_error(RegexMatcher( - r'^stdin:1: error in C function raises: \n' - r'Traceback \(most recent call last\):\n' + r'^Error: error in C function raises: \n' + r' Traceback \(most recent call last\):\n' r'.+' r'AssertionError: foo\n\n' - r'Backtrace:\n' - r'\tstdin:1, in function `raises`\n' - r'\tstdin:1\n$', + r' Backtrace:\n' + r' \tstdin:0, in function `raises`\n' + r' \tstdin:0\n' + r' on line 1 of stdin\n$' )): compile_with_func('a { content: raises(); }') def test_warning(self): with assert_raises_compile_error( - 'stdin:1: warning in C function returns-warning: ' + 'Error: warning in C function returns-warning: ' 'This is a warning\n' - 'Backtrace:\n' - '\tstdin:1, in function `returns-warning`\n' - '\tstdin:1\n' + ' Backtrace:\n' + ' \tstdin:0, in function `returns-warning`\n' + ' \tstdin:0\n' + ' on line 1 of stdin\n' ): compile_with_func('a { content: returns_warning(); }') def test_error(self): with assert_raises_compile_error( - 'stdin:1: error in C function returns-error: ' - 'This is an error\n' - 'Backtrace:\n' - '\tstdin:1, in function `returns-error`\n' - '\tstdin:1\n', + 'Error: error in C function returns-error: This is an error\n' + ' Backtrace:\n' + ' \tstdin:0, in function `returns-error`\n' + ' \tstdin:0\n' + ' on line 1 of stdin\n' ): compile_with_func('a { content: returns_error(); }') def test_returns_unknown_object(self): with assert_raises_compile_error( - 'stdin:1: error in C function returns-unknown: ' + 'Error: error in C function returns-unknown: ' 'Unexpected type: `tuple`.\n' - 'Expected one of:\n' - '- None\n' - '- bool\n' - '- str\n' - '- SassNumber\n' - '- SassColor\n' - '- SassList\n' - '- dict\n' - '- SassMap\n' - '- SassWarning\n' - '- SassError\n\n' - 'Backtrace:\n' - '\tstdin:1, in function `returns-unknown`\n' - '\tstdin:1\n', + ' Expected one of:\n' + ' - None\n' + ' - bool\n' + ' - str\n' + ' - SassNumber\n' + ' - SassColor\n' + ' - SassList\n' + ' - dict\n' + ' - SassMap\n' + ' - SassWarning\n' + ' - SassError\n\n' + ' Backtrace:\n' + ' \tstdin:0, in function `returns-unknown`\n' + ' \tstdin:0\n' + ' on line 1 of stdin\n' ): compile_with_func('a { content: returns_unknown(); }') def test_none(self): self.assertEqual( compile_with_func('a {color: #fff; content: returns_none();}'), - 'a{color:#fff}', + 'a{color:#fff}\n', ) def test_true(self): self.assertEqual( compile_with_func('a { content: returns_true(); }'), - 'a{content:true}', + 'a{content:true}\n', ) def test_false(self): self.assertEqual( compile_with_func('a { content: returns_false(); }'), - 'a{content:false}', + 'a{content:false}\n', ) def test_unicode(self): self.assertEqual( compile_with_func('a { content: returns_unicode(); }'), - u'@charset "UTF-8";\n' - u'a{content:☃}', + u'\ufeffa{content:☃}\n', ) def test_bytes(self): self.assertEqual( compile_with_func('a { content: returns_bytes(); }'), - u'@charset "UTF-8";\n' - u'a{content:☃}', + u'\ufeffa{content:☃}\n', ) def test_number(self): self.assertEqual( compile_with_func('a { width: returns_number(); }'), - 'a{width:5px}', + 'a{width:5px}\n', ) def test_color(self): self.assertEqual( compile_with_func('a { color: returns_color(); }'), - 'a{color:rgba(1,2,3,0.5)}', + 'a{color:rgba(1,2,3,0.5)}\n', ) def test_comma_list(self): self.assertEqual( compile_with_func('a { font-family: returns_comma_list(); }'), - 'a{font-family:Arial,sans-serif}', + 'a{font-family:Arial,sans-serif}\n', ) def test_space_list(self): self.assertEqual( compile_with_func('a { border-right: returns_space_list(); }'), - 'a{border-right:medium none}', + 'a{border-right:medium none}\n', ) def test_py_dict(self): @@ -1119,7 +1115,7 @@ def test_py_dict(self): compile_with_func( 'a { content: map-get(returns_py_dict(), foo); }', ), - 'a{content:bar}', + 'a{content:bar}\n', ) def test_map(self): @@ -1127,7 +1123,7 @@ def test_map(self): compile_with_func( 'a { content: map-get(returns_map(), foo); }', ), - 'a{content:bar}', + 'a{content:bar}\n', ) def test_identity_none(self): @@ -1135,38 +1131,37 @@ def test_identity_none(self): compile_with_func( 'a {color: #fff; content: identity(returns_none());}', ), - 'a{color:#fff}', + 'a{color:#fff}\n', ) def test_identity_true(self): self.assertEqual( compile_with_func('a { content: identity(returns_true()); }'), - 'a{content:true}', + 'a{content:true}\n', ) def test_identity_false(self): self.assertEqual( compile_with_func('a { content: identity(returns_false()); }'), - 'a{content:false}', + 'a{content:false}\n', ) def test_identity_strings(self): self.assertEqual( compile_with_func('a { content: identity(returns_unicode()); }'), - u'@charset "UTF-8";\n' - u'a{content:☃}', + u'\ufeffa{content:☃}\n', ) def test_identity_number(self): self.assertEqual( compile_with_func('a { width: identity(returns_number()); }'), - 'a{width:5px}', + 'a{width:5px}\n', ) def test_identity_color(self): self.assertEqual( compile_with_func('a { color: identity(returns_color()); }'), - 'a{color:rgba(1,2,3,0.5)}', + 'a{color:rgba(1,2,3,0.5)}\n', ) def test_identity_comma_list(self): @@ -1174,7 +1169,7 @@ def test_identity_comma_list(self): compile_with_func( 'a { font-family: identity(returns_comma_list()); }', ), - 'a{font-family:Arial,sans-serif}', + 'a{font-family:Arial,sans-serif}\n', ) def test_identity_space_list(self): @@ -1182,7 +1177,7 @@ def test_identity_space_list(self): compile_with_func( 'a { border-right: identity(returns_space_list()); }', ), - 'a{border-right:medium none}', + 'a{border-right:medium none}\n', ) def test_identity_py_dict(self): @@ -1190,7 +1185,7 @@ def test_identity_py_dict(self): compile_with_func( 'a { content: map-get(identity(returns_py_dict()), foo); }', ), - 'a{content:bar}', + 'a{content:bar}\n', ) def test_identity_map(self): @@ -1198,7 +1193,7 @@ def test_identity_map(self): compile_with_func( 'a { content: map-get(identity(returns_map()), foo); }', ), - 'a{content:bar}', + 'a{content:bar}\n', ) def test_list_with_map_item(self): @@ -1208,7 +1203,7 @@ def test_list_with_map_item(self): 'map-get(nth(identity(((foo: bar), (baz: womp))), 1), foo)' '}' ), - 'a{content:bar}' + 'a{content:bar}\n' ) def test_map_with_map_key(self): @@ -1216,7 +1211,7 @@ def test_map_with_map_key(self): compile_with_func( 'a{content: map-get(identity(((foo: bar): baz)), (foo: bar))}', ), - 'a{content:baz}', + 'a{content:baz}\n', ) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy